package traits

  1. Overview
  2. Docs

Module Traits.EqSource

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)

Sourcemodule type Trait = sig ... end

Eq implementation signature

Sourcemodule type T = sig ... end

Signature that defines Eq conformity

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

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

Sourceval 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

Sourceval 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