Module Monad.Ident

include Base__.Monad_intf.Syntax with type 'a t := 'a t
module Let_syntax : sig ... end
include Base__.Monad_intf.S_without_syntax with type 'a t := 'a t
val all_unit : 'a t list -> 'a t

Like all, but ensures that every monadic value in the list produces a unit value, all of which are discarded rather than being collected into a list.

val all : 'a t list -> 'a t
val ignore_m : 'a t -> 'a t

ignore_m t is map t ~f:(fun _ -> ()). ignore_m used to be called ignore, but we decided that was a bad name, because it shadowed the widely used Caml.ignore. Some monads still do let ignore = ignore_m for historical reasons.

val join : 'a t -> 'a t

join t is t >>= (fun t' -> t').

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

map t ~f is t >>| f.

val return : 'a -> 'a t

return v returns the (trivial) computation that returns v.

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

bind t ~f = t >>= f

module Monad_infix : sig ... end
include Base__.Monad_intf.Infix with type 'a t := 'a t
val (>>=) : 'a t -> ('a -> 'a t) -> 'a t

t >>= f returns a computation that sequences the computations represented by two monad elements. The resulting computation first does t to yield a value v, and then runs the computation returned by f v.

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

t >>| f is t >>= (fun a -> return (f a)).

type 'a t = 'a