Monad_plus.Over_monad_and_alternative
module Monad : Preface_specs.MONAD
module Alternative : Preface_specs.ALTERNATIVE with type 'a t = 'a Monad.t
type 'a t = 'a Alternative.t
The type held by the Monad_plus
.
include Preface_specs.Indexed_monad.WITH_RETURN
with type ('a, 'index) t := 'a t
include Preface_specs.Indexed_monad.WITH_RETURN
with type ('a, 'index) t := 'a t
include Preface_specs.Indexed_monad.WITH_RETURN
with type ('a, 'index) t := 'a t
val return : 'a -> 'a t
Lift a value into a t
.
val neutral : 'a t
The neutral element of the t
.
Composing monadic functions using Kleisli Arrow (from right to left).
Lift a binary function that acts on arbitrary values into a function that acts t
values.
Lift a ternary function that acts on arbitrary values into a function that acts t
values.
times_nel n x
apply combine
on x
n
times. If n
is lower than 1
the function will returns None
.
val reduce_nel : 'a t Preface_core.Nonempty_list.t -> 'a t
Reduce a Nonempty_list.t
using combine
.
Create a new t
, replacing all values of the given functor by given a value of 'a
.
times n x
apply combine
on x
n
times. If n
is lower than 1
the function will returns neutral
.
module Infix :
Preface_specs.Indexed_monad_plus.INFIX with type ('a, 'index) t := 'a t
Infix version of OPERATION
.compose_right_to_left.
Sequentially compose two actions, discarding any value produced by the first.
Sequentially compose two actions, discarding any value produced by the second.
Infix version of CORE
.map.
Flipped and infix version of CORE
.map.
Flipped and infix version of OPERATION
.replace.
module Syntax :
Preface_specs.Indexed_monad_plus.SYNTAX with type ('a, 'index) t := 'a t
Syntactic shortcuts for flipped version of CORE
.bind:
let* x = e in f
is equals to bind (fun x -> f) e
.