package preface

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

Choice is a Profunctor working on sum types (via Either).

Laws

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

  1. All Profunctor laws
  2. left = dimap Either.swap Either.swap % right
  3. right = dimap Either.swap Either.swap % left
  4. map_snd Either.left = contramap_fst Either.left % left
  5. map_snd Either.right = contramap_fst Either.right % right
  6. contramap_fst (Fun.Choice.right f) % left = map_snd (Fun.Choice.right f) % left
  7. contramap_fst (Fun.Choice.left f) % right = map_snd (Fun.Choice.left f) % right
  8. left % left = dimap assoc unassoc % left
  9. left % left = dimap unassoc assoc % right

Minimal definition

module type WITH_LEFT = sig ... end

Minimal interface using left and without Profunctor.

module type WITH_RIGHT = sig ... end

Minimal interface using right and without Profunctor.

module type WITH_DIMAP_AND_LEFT = sig ... end

Minimal interface dimap and left.

module type WITH_CONTRAMAP_FST_AND_MAP_SND_AND_LEFT = sig ... end

Minimal interface using contramap_fst and map_snd and left.

module type WITH_DIMAP_AND_RIGHT = sig ... end

Minimal interface using dimap and right.

Minimal interfaces using contramap_fst and map_snd and right.

Structure anatomy

module type CORE = sig ... end

Basis operations.

Complete API

module type API = sig ... end

The complete interface of a Choice Profunctor.

Additional references

OCaml

Innovation. Community. Security.