mnd

A small monads library
IN THIS PACKAGE

Mnd 1.0.0

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:

  • An interface to define monads with one or two type parameters
  • A small selection of monadic functions such as (>>=) or mapM
  • Support for let* and let+ syntax
  • A few standard instances of monads

The details can be found in the documentation. Feedback is welcome on the GitHub repository.

Functions

The individual functions are documented in the MONAD interface.

Syntax

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.

Instances

  • Option: Canonical instance of 'a option. Also known as Maybe.
  • Result: Canonical instance of ('a,'b) result. Also known as Error or Either.
  • Reader: Also known as Env, Environment or configuration monad.
  • Writer: Also known as logger monad.
  • State