Module Base.Comparable

val lexicographic : ('a -> 'a -> int) list -> 'a -> 'a -> int

lexicographic cmps x y compares x and y lexicographically using functions in the list cmps.

val lift : ('a -> 'a -> 'result) -> f:('b -> 'a) -> 'b -> 'b -> 'result

lift cmp ~f x y compares x and y by comparing f x and f y via cmp.

val reverse : ('a -> 'a -> 'result) -> 'a -> 'a -> 'result

reverse cmp x y = cmp y x

Reverses the direction of asymmetric relations by swapping their arguments. Useful, e.g., for relations implementing "is a subset of" or "is a descendant of".

Where reversed relations are already provided, use them directly. For example, Comparable.S provides ascending and descending, which are more readable as a pair than compare and reverse compare. Similarly, <= is more idiomatic than reverse (>=).

val equal : ('a -> 'a -> int) -> 'a -> 'a -> bool
val max : ('a -> 'a -> int) -> 'a -> 'a -> 'a
val min : ('a -> 'a -> int) -> 'a -> 'a -> 'a
module Inherit : functor (C : sig ... end) -> functor (T : sig ... end) -> S with type t := T.t

Inherit comparability from a component.

module Make : functor (T : sig ... end) -> S with type t := T.t
module Make_using_comparator : functor (T : sig ... end) -> S with type t := T.t with type comparator_witness := T.comparator_witness
module Poly : functor (T : sig ... end) -> S with type t := T.t
module Validate : functor (T : sig ... end) -> Validate with type t := T.t
module With_zero : functor (T : sig ... end) -> With_zero with type t := T.t
module Validate_with_zero : functor (T : sig ... end) -> sig ... end