package orsetto

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

Monad functions for functional progressive sequences.

Overview

This module augments the core monad interfaces with functions that facilitate monad functions that operate on sequences of monad values. It also provides a distinguished monad that encapsulates a sequence.

module Functor : sig ... end
Sequence Monad
type ('m, +'r) t

The type of a monad encapsulating a sequence.

Module inclusions

module Basis : Cf_monad_core.Binary.Basis with type ('m, 'r) t := ('m, 'r) t
include Cf_monad_core.Binary.Profile with type ('m, 'r) t := ('m, 'r) t
val return : 'r -> ('m, 'r) t

Use return a to apply the binding to a.

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

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

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

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

val product : ('m, 'a) t -> ('m, 'b) t -> ('m, 'a * '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) t

Open Affix to include the affix monad operators.

val disregard : ('m, 'r) t -> ('m, unit) 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 Functor.Binary with type ('m, 'r) t := ('m, 'r) t
val collect : ('m, 'r) t Seq.t -> ('m, int * 'r list) 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) t Seq.t -> ('m, unit) t

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

val one : 'm -> ('m, unit) t

Use one v to produce the value v in the encapsulated sequence.

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

Use all s to produce each value consumed from s in the encapsulated sequence.

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

Use eval m to convert m into its encapsulated sequence.

OCaml

Innovation. Community. Security.