package monadlib

  1. Overview
  2. Docs

Parameters

module Tag : sig ... end

Signature

type tag = Tag.t
include Monad.BaseCollectionM with type 'a m = (Tag.t, 'a LazyList.t) node

difference p xs ys removes all elements from xs which are less than or equal to some element in ys, according to the partial order p.

include Monad.BaseLazyPlus with type 'a m = (Tag.t, 'a LazyList.t) node
include BatInterfaces.Monad with type 'a m = (Tag.t, 'a LazyList.t) node
type 'a m = (Tag.t, 'a LazyList.t) node

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 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

difference p xs ys removes all elements from xs which are less than or equal to some element in ys, according to the partial order p.

val unique : ?cmp:('a -> 'a -> bool) -> 'a m -> 'a m

unique eq xs removes duplicates according to the function cmp.

val maxima : ('a -> 'a -> bool) -> 'a m -> 'a m

maxima p xs leaves only the maximal elements according to the partial order p.

val nub : ('a -> 'a -> bool) -> 'a m -> 'a m

nub p xs ys is the same as maxima, but some values might be treated as greater than others depending on their position in the collection.

For instance, with lists, we treat elements that occur earlier in the list as always greater than elements that occur later, otherwise we use p. This is really just an optimisation: in order to retrieve any value from maxima p xs, the maxima function will have had to seen every value. Not so with nub.

include Applicative.Base with type 'a m := 'a m
val return : 'a -> 'a m
val (<*>) : ('a -> 'b) m -> 'a m -> 'b m
val count : 'a m -> int
val to_list : 'a m -> 'a LazyList.t
val collapse : 'a m -> 'a m
val with_tags : 'a m -> (tag list * 'a) m
val branch : tag LazyList.t -> tag m
val print : ('a -> unit) -> 'a m -> unit
val to_forced : 'a m -> 'a m
OCaml

Innovation. Community. Security.