package monadlib

  1. Overview
  2. Docs

Transformer for writing data inside a collection.

Parameters

module W : sig ... end

Signature

include BaseCollectionM with type 'a m = 'a W.m C.m
include BaseLazyPlus with type 'a m = 'a W.m C.m
include BatInterfaces.Monad with type 'a m = 'a W.m C.m
type 'a m = 'a W.m C.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 zero : unit -> 'a m
val lplus : 'a m -> 'a m Stdlib.Lazy.t -> 'a m
val null : 'a m -> bool

null x implies that x is zero. If you do not want to or cannot answer whether a given x is zero, then null x should be false.

val difference : ('a -> 'a -> bool) -> 'a m -> 'a m -> 'a m
val unique : ('a -> 'a -> bool) -> 'a m -> 'a m
val maxima : ('a -> 'a -> bool) -> 'a m -> 'a m
val nub : ('a -> 'a -> bool) -> 'a m -> 'a m
val write : W.t -> unit m
val pass : 'a C.m -> 'a m

Promote the inner monad without writing any value.

val run : 'a m -> (W.t * 'a) C.m

Recover the inner monad with the final output value.

val cmp_on : ('a -> 'a -> bool) -> 'a W.m -> 'a W.m -> bool

Lift a comparison function to the writer.

OCaml

Innovation. Community. Security.