package traits

  1. Overview
  2. Docs

Eq defines primitives for equivalence for type t

In order for a module to implement Eq, it has to conform to the T signature, which implies conformance to PartialEq.T. In fact, Eq builds on top of it and simplity denotes that in addition to symmetricity and transitivity properties, reflexivity property is to be observed (eq a a)

module type Trait = sig ... end

Eq implementation signature

module type T = sig ... end

Signature that defines Eq conformity

module Make (T : sig ... end) : sig ... end

Defines a default implementation of Trait over an existing PartialEq.Trait definition

val eq : (module T with type Eq.t = 'a and type PartialEq.rhs = 'a and type PartialEq.t = 'a) -> 'a -> 'a -> bool

Tests x and y to be equal with a module M that implements signature T

val ne : (module T with type PartialEq.rhs = 'a and type PartialEq.t = 'a) -> 'a -> 'a -> bool

Tests x and y to be unequal with a module M that implements signature T

OCaml

Innovation. Community. Security.