package monadlib

  1. Overview
  2. Docs

A writer allows an additional output value to be written during computations and accumulated into a final result.

type t
include BatInterfaces.Monad
type 'a m

The type of a monad producing values of type 'a.

val bind : 'a m -> ('a -> 'b m) -> 'b m

Monadic binding.

bind m f executes first m then f, using the result of m.

val return : 'a -> 'a m

Return a value, that is, put a value in the monad.

val listen : 'a m -> (t * 'a) m

Listen to the written value.

val run : 'a m -> t * 'a

Run the writer, extracting both outputs.

val write : t -> unit m

Write a value.

OCaml

Innovation. Community. Security.