package mnd

  1. Overview
  2. Docs

Mnd 1.1.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. 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
OCaml

Innovation. Community. Security.