package orsetto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Use module M = Create(B) to create a module that implements all the conventional interfaces of a monad.

Parameters

module B : Basis

Signature

Module inclusions from Cf_monad_core and Cf_seqmonad.

include Core.Binary.Profile with type ('m, 'r) t := ('m, 'r) B.t
val return : 'r -> ('m, 'r) B.t

Use return a to apply the binding to a.

val bind : ('m, 'a) B.t -> ('a -> ('m, 'b) B.t) -> ('m, 'b) B.t

Use bind m f to bind f to the value returned by m.

val map : ('m, 'a) B.t -> f:('a -> 'b) -> ('m, 'b) B.t

Use map m ~f to return the result of applying f to the value returned by m.

val product : ('m, 'a) B.t -> ('m, 'b) B.t -> ('m, 'a * 'b) B.t

Use product a b to return the monoidal product of a and b.

module Affix : Cf_monad_core.Binary.Affix with type ('m, 'r) t := ('m, 'r) B.t

Open Affix to include the affix monad operators.

val disregard : ('m, 'r) B.t -> ('m, unit) B.t

Use disregard m to ignore the value returned by m and apply the unit value to the bound function.

module Infix = Affix

Deprecated module alias.

include Cf_seqmonad.Functor.Binary with type ('m, 'r) t := ('m, 'r) B.t
val collect : ('m, 'r) B.t Seq.t -> ('m, int * 'r list) B.t

Use collect s to bind in sequence every monad value in the finite sequence s and collect all the returned values. Returns (n, s) where n is the number of values collected and s is the list of values in reverse order, i.e. from last collected to first collected. Never returns and exhausts all memory if s never terminates.

val serial : ('m, unit) B.t Seq.t -> ('m, unit) B.t

Use serial s to bind in sequence every monad value in the sequence s.