module Monad: sig
.. end
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 __pa_ounit_275876e34cf609db118f3d84b799a790 : string
module type Basic = sig
.. end
module type Infix = sig
.. end
module type S = sig
.. end
module Make:
module type Basic2 = sig
.. end
Multi parameter monad.
module type Infix2 = sig
.. end
Same as Infix, except the monad type has two arguments.
module type S2 = sig
.. end
The same as S except the monad type has two arguments.
module Check_S2_refines_S: functor (
X
:
S
) ->
sig
.. end
module Make2:
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
.
t >>| f
is t >>= (fun a -> return (f a))
.
A monad is an abstraction of the concept of sequencing of computations. A value of
type 'a monad represents a computation that returns a value of type 'a.
bind t f
= t >>= f
return v
returns the (trivial) computation that returns v.
map t ~f
is t >>| f.
join t
is t >>= (fun t' -> t')
.
ignore t
= map t ~f:(fun _ -> ()).
Multi parameter monad.
The second parameter get unified across all the computation. This is used
to encode monads working on a multi parameter data structure like
(('a,'b result)
).
Same as Infix, except the monad type has two arguments. The second is always just
passed through.
The same as S except the monad type has two arguments. The second is always just
passed through.