Module Preface_specs.Contravariant

Contravariant is a "Contravariant functor". In other word, Contravariant is the dual of a Functor.

Laws

To have a predictable behaviour, the instance of Contravariant must obey some laws.

  1. contramap id = id
  2. (contramap f) % (contramap g) = contramap (g % f)

Minimal definition

module type WITH_CONTRAMAP = sig ... end

The minimum definition of a Contravariant. It is by using the combinators of this module that the other combinators will be derived.

Structure anatomy

module type CORE = WITH_CONTRAMAP

Basis operations.

module type OPERATION = sig ... end

Additional operations.

module type INFIX = sig ... end

Infix operators.

Complete API

module type API = sig ... end

The complete interface of a Contravariant Functor.

Additional references