Module Preface_specs.Divisible

Divisible is a "Contravariant Applicative Functor", in other word, Divisible is the dual of an Applicative

Laws

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

  1. All Contravariant laws
  2. divide f x conquer = contramap (Stdlib.fst % f) x
  3. divide f conquer x = contramap (Stdlib.snd % f) x
  4. divide f (divide g m n) o
    = divide
        (fun x ->
          let bc, _ = f x in
          let b, c = g bc in
          (a, (b, c)) )
        m (divide id n o)

Minimal definition

module type WITH_DIVIDE_AND_CONQUER = sig ... end

Exposes the divide and conquer functions, mandatory for each requirement.

module type WITH_CONTRAMAP_AND_DIVIDE_AND_CONQUER = sig ... end

Structure anatomy

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 Divisible.

Additional references