jon.recoil.org

Module Monad.ResultSource

Sourcetype ('a, 'e) t = ('a, 'e) result
Sourceval bind : ('a, 'e) t -> ('a -> ('b, 'e) t) -> ('b, 'e) t
Sourceval (>>=) : ('a, 'e) t -> ('a -> ('b, 'e) t) -> ('b, 'e) t

>>= is a synonym for bind

Sourceval return : 'a -> ('a, _) t

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

Sourceval map : ('a -> 'b) -> ('a, 'e) t -> ('b, 'e) t
Sourceval join : (('a, 'e) t, 'e) t -> ('a, 'e) t

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

Sourceval both : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) t
Sourceval ignore_m : (_, 'e) t -> (unit, 'e) t

ignore_m t is map (fun _ -> ()) t.

Sourceval all : ('a, 'e) t list -> ('a list, 'e) t
Sourceval all_unit : (unit, 'e) t list -> (unit, 'e) 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.

Sourcemodule Syntax : sig ... end

As described at https://ocaml.org/manual/latest/bindingops.html