Preface_specs.Profunctor
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.
To have a predictable behaviour, the instance of Bifunctor
must obey some laws.
dimap id id = id
contramap_fst id = id
map_snd id = id
dimap f g = contramap_fst f % map_snd g
dimap (f % g) (h % i) = dimap g h % dimap f i
contramap_fst (f % g) = contramap_fst g % contramap_fst f
map_snd (f % g) = map_snd f % map_snd g
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
.
module type CORE = sig ... end
Basis operations.
module type API = CORE
The complete interface of a Profunctor
.