Preface_specs.Strong
Strong
is a Profunctor
working on product types.
To have a predictable behaviour, the instance of Strong
must obey some laws.
Profunctor
lawsfst = dimap Pair.swap Pair.swap % snd
contramap_fst Pair.fst = map_snd Pair.fst % fst
contramap_fst (Fun.snd f) % fst = map_snd (Fun.snd f) % fst
fst % fst = dimap (fun ((a,b),c) -> (a,(b,c))) (fun (a,(b,c)) -> ((a,b),c)) % fst
snd = dimap Pair.swap Pair.swap % fst
contramap_fst Pair.snd = map_snd Pair.snd % snd
contramap_fst (Fun.fst f) % snd = map_snd (Fun.fst f) % snd
snd % snd = dimap (fun (a,(b,c)) -> ((a,b),c)) (fun ((a,b),c) -> (a,(b,c))) % snd
module type WITH_FST = sig ... end
Minimal interface using with fst
and without Profunctor
requirements.
module type WITH_SND = sig ... end
Minimal interface using with snd
and without Profunctor
requirements.
module type WITH_DIMAP_AND_FST = sig ... end
Minimal interface using dimap
and fst
.
module type WITH_CONTRAMAP_FST_AND_MAP_SND_AND_FST = sig ... end
Minimal interface using contramap_fst
and map_snd
and fst
.
module type WITH_DIMAP_AND_SND = sig ... end
Minimal interface using dimap
and snd
.
module type WITH_CONTRAMAP_FST_AND_MAP_SND_AND_SND = sig ... end
Minimal interface using contramap_fst
and map_snd
and snd
.
module type CORE = sig ... end
Basis operations.
module type OPERATION = sig ... end
Additional operations.
module type API = sig ... end
The complete interface of a Strong Profunctor
.