package monadlib

  1. Overview
  2. Docs

Module type Monad.Stream

Streams supporting unbounded search. Technically, all streams should be infinite, but for efficiency, we allow them to be truncated. As such, it is impossible to define a general null predicate for streams. Here, we have null return true for the particular case that the stream is an empty list.

type 'a t
include BaseLazyPlus with type 'a m = 'a t Lazy.t
include BatInterfaces.Monad with type 'a m = 'a t Stdlib.Lazy.t
type 'a m = 'a t Lazy.t
val bind : 'a m -> ('a -> 'b m) -> 'b m
val return : 'a -> 'a m
val zero : unit -> 'a m
val lplus : 'a m -> 'a m 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 iterate : ('a m -> 'a m) -> 'a m -> 'a m

The sum of the stream [f x, f (f x), f (f (f x)),...]

val delay : 'a m -> 'a m

Delay to prevent deadlock.

val to_depth : int -> 'a m -> 'a m

Search to some depth.

OCaml

Innovation. Community. Security.