package monadlib
Module Monad
Monads with additional structure.
Base Modules
module type Monoid = sig ... endmodule type BasePlus = sig ... endMonads with additional monoid structure.
module type BaseLazyPlus = sig ... endLazyPlus provides a plus operation which is non-strict in its second argument.
module type Writer = sig ... endA writer allows an additional output value to be written during computations and accumulated into a final result.
module type BaseCollectionM = sig ... endMonads for collections.
Library Types
module type Monad = sig ... endLibrary functions for monads.
module type MonadPlus = sig ... endLibrary functions for monads with additional structure..
module type LazyPlus = sig ... endLibrary functions for lazy monads.
module type Stream = sig ... endStreams 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.
module type StreamC = sig ... endStreams whose generations are themselves collections
Library Creation
module MakeLazyPlus (M : BaseLazyPlus) : LazyPlus with type 'a m = 'a M.mLazyPlus library.
Defined Monads
module Lazyt
(M : BatInterfaces.Monad) :
BatInterfaces.Monad with type 'a m = 'a Stdlib.Lazy.t M.mmodule LazyListM : BaseLazyPlus with type 'a m = 'a LazyList.tmodule MakeWriter (M : Monoid) : sig ... endA writer which combines the output values using some plus operation.
Transformers
module Listt
(M : BatInterfaces.Monad) :
BatInterfaces.Monad with type 'a m = 'a list M.mList monad transformer.
module Optiont
(M : BatInterfaces.Monad) :
BatInterfaces.Monad with type 'a m = 'a option M.mOption monad transformer
module MakeStream (M : sig ... end) : sig ... endThe plus operation of the inner monoid should be i commutative, or alternatively, values should only be extracted by an embedding into a commutative monoid such as sort.
module MakeStreamC (M : sig ... end) : sig ... endCreation of a stream with underlying type 'a CollectionM.m.
module CollectionOpt (C : BaseCollectionM) : sig ... endTransformer allowing optional values in a collection.
module CollectionWriter (W : sig ... end) (C : BaseCollectionM) : sig ... endTransformer for writing data inside a collection.
module CollectionState (T : sig ... end) (C : BaseCollectionM) : sig ... endState inside a collection.