Preface_specs.Choice
Choice
is a Profunctor
working on sum types (via Either
).
To have a predictable behaviour, the instance of Strong
must obey some laws.
Profunctor
lawsleft = dimap Either.swap Either.swap % right
right = dimap Either.swap Either.swap % left
map_snd Either.left = contramap_fst Either.left % left
map_snd Either.right = contramap_fst Either.right % right
contramap_fst (Fun.Choice.right f) % left = map_snd (Fun.Choice.right f) % left
contramap_fst (Fun.Choice.left f) % right = map_snd (Fun.Choice.left f) % right
left % left = dimap assoc unassoc % left
left % left = dimap unassoc assoc % right
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
.
module type WITH_CONTRAMAP_FST_AND_MAP_SND_AND_RIGHT = sig ... end
Minimal interfaces using contramap_fst
and map_snd
and right
.
module type CORE = sig ... end
Basis operations.
module type API = sig ... end
The complete interface of a Choice Profunctor
.