Module Comparable.Make
Parameters
T : sig ... end
Signature
include Base__.Comparable_intf.Validate with type t := T.t
val validate_bound : min:T.t Base.Maybe_bound.t -> max:T.t Base.Maybe_bound.t -> T.t Base.Validate.check
val validate_ubound : max:T.t Base.Maybe_bound.t -> T.t Base.Validate.check
val validate_lbound : min:T.t Base.Maybe_bound.t -> T.t Base.Validate.check
include Base.Comparator.S with type t := T.t
val comparator : (T.t, comparator_witness) Base.Comparator.comparator
val clamp : T.t -> min:T.t -> max:T.t -> T.t Base.Or_error.t
val clamp_exn : T.t -> min:T.t -> max:T.t -> T.t
clamp_exn t ~min ~max
returnst'
, the closest value tot
such thatbetween t' ~low:min ~high:max
is true.Raises if
not (min <= max)
.
val descending : T.t -> T.t -> int
val ascending : T.t -> T.t -> int
ascending
is identical tocompare
.descending x y = ascending y x
. These are intended to be mnemonic when used likeList.sort ~compare:ascending
andList.sort ~cmp:descending
, since they cause the list to be sorted in ascending or descending order, respectively.