traits

Common traits for generic functionality
Library traits
Module Traits . PartialEq . T . PartialEq
type t

Type being compared

type rhs

Type being compared with

val eq : t -> rhs -> bool

Equality definition.

It must satisfy all of the following conditions:

  1. Symmetry: if module A implements PartialEq and module B implements PartialEq, and A.PartialEq.t is equal to B.PartialEq.rhs and B.PartialEq.t is equal to A.PartialEq.rhs, then eq (module A) a b implies eq (module B) b a
  2. Transitivity: if modules A, A', B and C all implement PartialEq, and A.PartialEq.rhs is equal to B.PartialEq.t, and B.PartialEq.rhs is equal to C.PartialEq.t, and A'.Partial.rhs is equal to c.PartialEq.t, then eq (module A) a b and eq (module B) b c implies eq (module A') a c
val ne : t -> rhs -> bool

Inequality definition. Must ensure that it is consistent with eq: ne x y if true if and only if not (eq x y)

In most cases, Traits.PartialEq.Make should be used to derive this function automatically. However, there may be cases where it may be more desirable (efficient, clear) to implement it manually.