Module Base.ComparatorSource
Comparison and serialization for a type, using a witness type to distinguish between comparison functions with different behavior.
('a, 'witness) t contains a comparison function for values of type 'a. Two values of type t with the same 'witness are guaranteed to have the same comparison function.
val make :
compare:('a -> 'a -> int) ->
sexp_of_t:('a -> Base.Sexp.t) ->
(module Base.Comparator.S_fc
with type comparable_t = 'a)make creates a comparator witness for the given comparison. It is intended as a lightweight alternative to the functors below, to be used like so:
include (val Comparator.make ~compare ~sexp_of_t)module S_to_S1
(S : Base.Comparator.S) :
Base.Comparator.S1
with type 'a t = S.t
with type comparator_witness = S.comparator_witnessMake creates a comparator value and its phantom comparator_witness type for a nullary type.
Make1 creates a comparator value and its phantom comparator_witness type for a unary type. It takes a compare and sexp_of_t that have non-standard types because the Comparator.t type doesn't allow passing in additional values for the type argument.
Derived creates a comparator function that constructs a comparator for the type 'a t given a comparator for the type 'a.
module Derived2
(M : sig ... end) :
Base.Comparator.Derived2 with type ('a, 'b) t := ('a, 'b) M.tDerived2 creates a comparator function that constructs a comparator for the type ('a, 'b) t given comparators for the type 'a and 'b.
module Derived_phantom
(M : sig ... end) :
Base.Comparator.Derived_phantom with type ('a, 'b) t := ('a, 'b) M.tDerived_phantom creates a comparator function that constructs a comparator for the type ('a, 'b) t given a comparator for the type 'a.
module Derived2_phantom
(M : sig ... end) :
Base.Comparator.Derived2_phantom with type ('a, 'b, 'c) t := ('a, 'b, 'c) M.tDerived2_phantom creates a comparator function that constructs a comparator for the type ('a, 'b, 'c) t given a comparator for the types 'a and 'b.