package preface

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

A Bifunctor is a type constructor that takes two type arguments and is a Functor (Covariant) in both arguments.

Laws

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

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

Minimal definition

module type WITH_BIMAP = sig ... end

Minimal interface using bimap.

module type WITH_MAP_FST_AND_MAP_SND = sig ... end

Minimal interface using map_fst and map_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 Bifunctor.

Additional references

OCaml

Innovation. Community. Security.