monads

A missing monad library
IN THIS PACKAGE
Parameter #1 Monads . Std . Monad . Result . Make2 . M . Collection . Delay . T
include Collection.Basic
type 'a t

x t a container that hold values of type x

val return : 'a -> 'a t

return x creates a singleton container holding x

include Plus.S with type 'a t := 'a t
val zero : unit -> 'a t

zero () constructs a zero element

val plus : 'a t -> 'a t -> 'a t

plus x y an associative operation.

val fold : 'a t -> init:'s -> f:( 's -> 'a -> ( 's -> 'r ) -> 'r ) -> ( 's -> 'r ) -> 'r

fold xs ~init:s ~f a delayed fold implementation. It is the same as a regular fold except that function f accepts an extra continuation argument, and the fold expression returns a continuation.