From 62587eeec9d380c07865b1560d3bf98761668953 Mon Sep 17 00:00:00 2001 From: Mathieu Barbin Date: Tue, 31 Oct 2023 10:15:53 +0100 Subject: [PATCH] Use local substitution in signatures - I find it easier to read - This avoids the extra indentation created by ocamlformat.0.26.1 --- src/natural_ratio.mli | 55 +++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/natural_ratio.mli b/src/natural_ratio.mli index 7b49b7f..6820e17 100644 --- a/src/natural_ratio.mli +++ b/src/natural_ratio.mli @@ -14,31 +14,30 @@ val multiply : t -> t -> t val divide : t -> t -> t module Reduced : sig - type natural_ratio - - (** A [natural_ratio] kept in its primed decomposition form. *) - type t [@@deriving sexp_of] - - val to_string : t -> string - val equal : t -> t -> bool - val one : t - - (** [prime] is assumed to be a prime number. The resulting [t] will be invalid - and the behavior of the rest of the module unspecified if it isn't. The - exponent is expected to be non null. Checking that [prime] is indeed - prime is only done if its value is small enough. This should suffice in - practice, since creating such values is done with small ps. *) - val create_exn : prime:int -> exponent:int -> t - - val compound : t list -> t - val inverse : t -> t - val multiply : t -> t -> t - val divide : t -> t -> t - val to_natural_ratio : t -> natural_ratio - - (** When both the numerator and denominator and below a small bound, this - function can be used to instantiate a [t]. Raises if out of supported - bounds. *) - val of_small_natural_ratio_exn : numerator:int -> denominator:int -> t - end - with type natural_ratio := t + type natural_ratio := t + + (** A [natural_ratio] kept in its primed decomposition form. *) + type t [@@deriving sexp_of] + + val to_string : t -> string + val equal : t -> t -> bool + val one : t + + (** [prime] is assumed to be a prime number. The resulting [t] will be invalid + and the behavior of the rest of the module unspecified if it isn't. The + exponent is expected to be non null. Checking that [prime] is indeed + prime is only done if its value is small enough. This should suffice in + practice, since creating such values is done with small ps. *) + val create_exn : prime:int -> exponent:int -> t + + val compound : t list -> t + val inverse : t -> t + val multiply : t -> t -> t + val divide : t -> t -> t + val to_natural_ratio : t -> natural_ratio + + (** When both the numerator and denominator and below a small bound, this + function can be used to instantiate a [t]. Raises if out of supported + bounds. *) + val of_small_natural_ratio_exn : numerator:int -> denominator:int -> t +end