Module Monad.Writer

The Writer monad.

The writer monad denotes a simple effectful computations. The environment is represented with some type that should form the monoid. Effects are accumulated using the operation. The Writer monad is also known a the Logger monad.

module type S = sig ... end
type ('a, 'b) writer
module T1 (T : Monoid.S) (M : Monad) : sig ... end
module Make (T : Monoid.S) (M : Monad) : S with type 'a m := 'a T1(T)(M).m and type 'a t := 'a T1(T)(M).t and type 'a e := 'a T1(T)(M).e and type state := T1(T)(M).state

Make(Sum)(M) constructs a reader that uses Sum.t type as a state accumulator and composes the Writer with the monad M.