type 'a t

'a t is the type of computations of type 'a

val return : 'a -> 'a t

return x injects a value x as a computation

val bind : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind

val map : 'a t -> ('a -> 'b) -> 'b t

Functorial map

val map2 : 'a t -> 'b t -> ('a -> 'b -> 'c) -> 'c t

Applicative structure

val map_array : 'a t array -> ('a array -> 'b) -> 'b t

N-ary applicative structure

val if_ : bool t -> (bool -> 'a t) -> 'a t

If-then-else, mostly useful for monads featuring incremental computation. Allows to efficiently bind on a boolean computation.

module Infix : Infix with type 'a t := 'a t