Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
A small library for programming with monads. It aims to be comprehensible instead of comprehensive Everything is standard and already exists in various places, this is simply a selection for easy re-use:
(>>=)
or mapM
let*
and let+
syntaxThe details can be found in the documentation. Feedback is welcome on the GitHub repository.
The individual functions are documented in the MONAD
interface.
OCaml 4.08.0 added support for user-defined binding operators to facilitate working with monads and similar structures. Monads defined with this library automatically have access to the let*
and let+
syntax.
Option
: Canonical instance of 'a option
. Also known as Maybe
.Result
: Canonical instance of ('a,'b) result
. Also known as Error
or Either
. Provides and*
and and+
with the semantics that if either compuation fails, the combined product computation also fails. If both arguments of a product fail then the result is the error of the first one.Reader
: Also known as Env
, Environment
or configuration monad.Writer
: Also known as logger monad.State