Preface_specs.Comonad
A Comonad
is the dual of the Monad
.
extend extract = id
(extend %> extract) f = f
extend g %> extend f = extend (extend g %> f)
f =>= extract = f
extract =>= f = f
(f =>= g) =>= h = f =>= (g =>= h)
extract <% duplicate = id
fmap extract <% duplicate = id
duplicate %> duplicate = fmap duplicate <% duplicate
extend f = fmap f <% duplicate
duplicate = extend id
fmap f = extend (f <% extract)
module type WITH_MAP_AND_DUPLICATE = sig ... end
Minimal definition using extract
, map
and duplicate
.
module type WITH_EXTEND = sig ... end
Minimal definition using extract
and extend
.
module type WITH_COKLEISLI_COMPOSITION = sig ... end
Minimal definition using extract
and compose_left_to_right
.
module type CORE = sig ... end
Basis operations.
module type OPERATION = sig ... end
Additional operations.
module type SYNTAX = sig ... end
Syntax extensions.
module type INFIX = sig ... end
Infix operators.
module type API = sig ... end
The complete interface of a Comonad
.
A standard representation of a comonad transformer. (It is likely that not all transformers respect this interface)
module type TRANSFORMER = sig ... end