A type-indexed value that allows one to compare (and for generating error messages, serialize) values of the type in question.
One of the type parameters is a phantom parameter used to distinguish comparators potentially built on different comparison functions. In particular, we want to distinguish those using polymorphic compare and those using a monomorphic compare.
module type S : sig ... end
module type S1 : sig ... end
module type S_fc : sig ... end
val make : compare:('a ‑> 'a ‑> int) ‑> sexp_of_t:('a ‑> Sexp.t) ‑> (module 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 : functor (S : S) -> S1 with type 'a t = S.t with type comparator_witness = S.comparator_witness