Comparer.Make
Make
takes a compare
function, mints a fresh compare
type to act as a singleton type denoting that one compare function, and returns the compare
function at a type stamped with its singleton type. In this way, Make
applied to two different compare functions for the same type of values yields comparers with incompatible types.
module Ord : sig ... end
type ('a, 'compare_a) comparer := ('a, 'compare_a) t
type t = Ord.t
compare
types are equipped with functions to support use of @@deriving compare, equal, sexp
on types parameterized by such singleton types for compare functions. These derived functions are never actually called, since the compare type parameters are phantom.
val sexp_of_compare : compare -> Sexplib0.Sexp.t
val compare_of_sexp : Sexplib0.Sexp.t -> compare