Preface_specs.BifunctorA Bifunctor is a type constructor that takes two type arguments and is a Functor (Covariant) in both arguments.
To have a predictable behaviour, the instance of Bifunctor must obey some laws.
bimap id id = idmap_fst id = idmap_snd id = idbimap f g = map_fst f % map_snd gbimap (f % g) (h % i) = bimap f h % bimap g imap_fst (f % g) = map_fst f % map_snd gmap_snd (f % g) = map_snd f % map_snd gmodule type WITH_BIMAP = sig ... endMinimal interface using bimap.
module type WITH_MAP_FST_AND_MAP_SND = sig ... endMinimal interface using map_fst and map_snd.
module type CORE = sig ... endBasis operations.
module type OPERATION = sig ... endAdditional operations.
module type API = sig ... endThe complete interface of a Bifunctor.