Module Support.Eq

Types having an equality operator.

module type EQ = sig ... end

Module type for types with an equality predicate and operators.

module Make (T : sig ... end) : EQ with type t = T.t

Functor building an implementation of EQ given a type with a structural equality function.

val make : ('t -> 't -> bool) -> (module EQ with type t = 't)

make equal is equivalent to the functor Make (T) with T.equal = equal.

val contramap : (module EQ with type t = 's) -> ('t -> 's) -> (module EQ with type t = 't)

If val f : 't -> 's, then contramap eq f is an instance of EQ for values of type 't by the EQ instance eq for values of type 's.

val conjunction : (module EQ with type t = 's1) -> (module EQ with type t = 's2) -> ('t -> 's1) -> ('t -> 's2) -> (module EQ with type t = 't)

If val f1 : 't -> 's1 and val f2 : 't -> 's2, then conjunction eq1 eq2 f1 f2 is an instance of EQ for values of type 't that first checks equality by contramapping by eq1 and f1, and if that check was true then checks equality by contramapping by eq2 and f2.