package preface

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A Profunctor is a type constructor that takes two type arguments and is a Contravariant Functor as first argument and a covariant Functor as second argument.

Laws

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

  1. dimap id id = id
  2. contramap_fst id = id
  3. map_snd id = id
  4. dimap f g = contramap_fst f % map_snd g
  5. dimap (f % g) (h % i) = dimap g h % dimap f i
  6. contramap_fst (f % g) = contramap_fst g % contramap_fst f
  7. map_snd (f % g) = map_snd f % map_snd g

Minimal definition

module type WITH_DIMAP = sig ... end

Minimal interface using dimap.

module type WITH_CONTRAMAP_FST_AND_MAP_SND = sig ... end

Minimal interface using contramap_fst and map_snd.

Structure anatomy

module type CORE = sig ... end

Basis operations.

Complete API

module type API = CORE

The complete interface of a Profunctor.

Additional references

OCaml

Innovation. Community. Security.