Module Generic_util_monad.IO

module IO: sig .. end


Similar to the Haskell IO Monad. The values are computations that may carry effects. The monadic bind is used to sequence the effects.

The constructor Generic_util_monad.IO.IO and synonym Generic_util_monad.IO.embed_io allow to embed an effectful computation in the monad. Generic_util_monad.IO.run_io runs it.

type io = 
| IO_
Generic_util_monad.IO.io is used as a type index for T.app
type ('_, '_) App.T.app += 
| IO : (unit -> 'a) -> ('a, io) App.T.app
Embed an effectful computation in the IO monad
val embed_io : (unit -> 'a) -> ('a, io) App.T.app
Embed an effectful computation in the IO monad
val run_io : ('a, io) App.T.app -> 'a
Run the computation with side effects to obtain a result
val io : io Generic_util_monad.monad
The IO monad operations