Module Preface_specs.Closed

Closed is a Profunctor working on exponential types (function).

Laws

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

  1. All Profunctor laws
  2. contramap_fst (fun x -> x % f) % closed = map_snd (fun x -> x % f) % closed
  3. closed % closed = dimap uncurry curry % closed
  4. dimap const (fun f -> f ()) % closed = id

Minimal definition

module type WITH_CLOSED = sig ... end

Minimum interface using closed and without Profunctor requirements.

module type WITH_DIMAP_AND_CLOSED = sig ... end

Minimum interface using dimap and closed.

Minimum interface using contramap_fst and map_snd and closed.

Structure anatomy

module type CORE = sig ... end

Basis operations.

module type OPERATION = sig ... end

Additional operations.

Complete API

module type API = sig ... end

The complete interface of a Closed Profunctor.

Additional references