Module Preface_specs.Strong

Strong is a Profunctor working on product types.

Laws

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

  1. All Profunctor laws
  2. fst = dimap Pair.swap Pair.swap % snd
  3. contramap_fst Pair.fst = map_snd Pair.fst % fst
  4. contramap_fst (Fun.snd f) % fst = map_snd (Fun.snd f) % fst
  5. fst % fst = dimap (fun ((a,b),c) -> (a,(b,c))) (fun (a,(b,c)) -> ((a,b),c)) % fst
  6. snd = dimap Pair.swap Pair.swap % fst
  7. contramap_fst Pair.snd = map_snd Pair.snd % snd
  8. contramap_fst (Fun.fst f) % snd = map_snd (Fun.fst f) % snd
  9. snd % snd = dimap (fun (a,(b,c)) -> ((a,b),c)) (fun ((a,b),c) -> (a,(b,c))) % snd

Minimal definition

module type WITH_FST = sig ... end

Minimal interface using with fst and without Profunctor requirements.

module type WITH_SND = sig ... end

Minimal interface using with snd and without Profunctor requirements.

module type WITH_DIMAP_AND_FST = sig ... end

Minimal interface using dimap and fst.

module type WITH_CONTRAMAP_FST_AND_MAP_SND_AND_FST = sig ... end

Minimal interface using contramap_fst and map_snd and fst.

module type WITH_DIMAP_AND_SND = sig ... end

Minimal interface using dimap and snd.

module type WITH_CONTRAMAP_FST_AND_MAP_SND_AND_SND = sig ... end

Minimal interface using contramap_fst and map_snd and snd.

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 Strong Profunctor.

Additional references