monads

A missing monad library
IN THIS PACKAGE
Module Monads . Std . Monad . Writer . Make . Fn
val id : 'a -> 'a T1(T)(M).t

id x a monadic identity function

val ignore : 'a T1(T)(M).t -> unit T1(T)(M).t

ignore m computes m and discards the result.

val nothing : unit -> unit T1(T)(M).t

nothing is a computation that does nothing.

val non : ( 'a -> bool T1(T)(M).t ) -> 'a -> bool T1(T)(M).t

non f returns a negation of the function f.

val apply_n_times : n:int -> ( 'a -> 'a T1(T)(M).t ) -> 'a -> 'a T1(T)(M).t

apply_n_times ~n f creates a chaing of computation of size n made from applications of the same function to its own result.

val compose : ( 'b -> 'c T1(T)(M).t ) -> ( 'a -> 'b T1(T)(M).t ) -> 'a -> 'c T1(T)(M).t

compose f g creates a composition f.g of two function.