Module Base.Comparable
module type Infix = Base__.Comparable_intf.Infix
module type S = Base__.Comparable_intf.S
module type Validate = Base__.Comparable_intf.Validate
module type With_zero = Base__.Comparable_intf.With_zero
val lexicographic : ('a -> 'a -> int) list -> 'a -> 'a -> int
lexicographic cmps x y
comparesx
andy
lexicographically using functions in the listcmps
.
val lift : ('a -> 'a -> 'result) -> f:('b -> 'a) -> 'b -> 'b -> 'result
lift cmp ~f x y
comparesx
andy
by comparingf x
andf y
viacmp
.
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
providesascending
anddescending
, which are more readable as a pair thancompare
andreverse compare
. Similarly,<=
is more idiomatic thanreverse (>=)
.
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 Polymorphic_compare : functor (T : sig ... end) -> Polymorphic_compare with type t := T.t
module Inherit : functor (C : sig ... end) -> functor (T : sig ... end) -> S with type t := T.t
Inherit comparability from a component.
module Make_using_comparator : functor (T : sig ... end) -> S with type t := T.t with type comparator_witness := T.comparator_witness
module Validate_with_zero : functor (T : sig ... end) -> sig ... end