Module Dagger.Identity_monadSource

Sourcemodule M : Intf.Core with type 'a t = 'a and type 'a res = 'a
include module type of struct include M end
Sourcetype 'a t = 'a

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

Sourcetype 'a res = 'a

'a res is the outcome of running a computation of type 'a

Sourceval return : 'a -> 'a t

return x injects a value x as a computation

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

Monadic bind

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

Functorial map

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

Applicative structure

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

N-array applicative structure

Sourceval 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.

Sourceval run : 'a t -> 'a res

Running a monadic computation

Sourcemodule Infix = M.Infix