module Monad: Generic_util_monad
Monads and instances for option, list, identity, state, reader, input-output.
module T: sig
.. end
type 'f
monad = 'f T.monad
= {
|
return : 'a. 'a -> ('a, 'f) App.T.app ; |
|
bind : 'a 'b. ('a, 'f) App.T.app -> ('a -> ('b, 'f) App.T.app) -> ('b, 'f) App.T.app ; |
}
type 'f
t = 'f monad
Operations
val fun_of_mon : 'a monad -> 'a Functor.T.functorial
val app_of_mon : 'a monad -> 'a Applicative.T.applicative
val join : 'a monad ->
(('b, 'a) App.T.app, 'a) App.T.app ->
('b, 'a) App.T.app
val liftM : 'a monad ->
('b -> 'c) ->
('b, 'a) App.T.app -> ('c, 'a) App.T.app
val liftM2 : 'a monad ->
('b -> 'c -> 'd) ->
('b, 'a) App.T.app ->
('c, 'a) App.T.app -> ('d, 'a) App.T.app
val liftM3 : 'a monad ->
('b -> 'c -> 'd -> 'e) ->
('b, 'a) App.T.app ->
('c, 'a) App.T.app ->
('d, 'a) App.T.app -> ('e, 'a) App.T.app
val liftM4 : 'a monad ->
('b -> 'c -> 'd -> 'e -> 'f) ->
('b, 'a) App.T.app ->
('c, 'a) App.T.app ->
('d, 'a) App.T.app ->
('e, 'a) App.T.app -> ('f, 'a) App.T.app
Traversing lists of effectful elements
val traverseM : 'f monad ->
('a -> ('b, 'f) App.T.app) ->
'a list -> ('b list, 'f) App.T.app
val sequenceM : 'f monad ->
('a, 'f) App.T.app list -> ('a list, 'f) App.T.app
Instances
val id : App.id monad
val option : App.option' monad
val list : App.list' monad
State Monad
module State: sig
.. end
Reader Monad
module Reader: sig
.. end
IO Monad
module IO: sig
.. end