Preface_specs.Alternative
Alternative
is a kind of Monoid
on Applicative
. An Alternative
is formally an Applicative
with neutral
and combine
. So an Alternative
is also an Applicative
(and an Alt
which is also a Functor
).
To have a predictable behaviour, the instance of Alternative
must obey some laws.
Applicative
lawsAlt
lawscombine x neutral = combine neutral x = x
module type WITH_NEUTRAL_AND_COMBINE = sig ... end
Minimal interfaces of Alternative
without Applicative
.
module type WITH_PURE_MAP_AND_PRODUCT = sig ... end
Minimal definition using neutral
, combine
, pure
, map
and product
.
module type WITH_PURE_AND_APPLY = sig ... end
Minimal definition using neutral
, combine
, pure
and apply
.
module type WITH_PURE_AND_LIFT2 = sig ... end
Minimal definition using neutral
, combine
, pure
and lift2
.
module type CORE = sig ... end
Basis operations.
module type ALTERNATIVE_OPERATION = sig ... end
Operation without Applicative
.
module type OPERATION = sig ... end
Additional operations.
module type INFIX = sig ... end
Infix operators.
module type SYNTAX = sig ... end
Syntax extensions.
module type API = sig ... end
The complete interface of an Alternative
.