Module Monads.Std.Monad.Fun

module Fun: sig .. end

The Function Monad.

The function monad delays the computation until it is actually run. This is not the only monad that has such behavior, i.e., State, Cont, Lazy, and Reader monads are also delayed, but they all have other additional behaviors on top of the delaying the computation. The function monad can be seen as a Reader monad with unit environment, or as a Lazy monad without the memoization.


module type S = sig .. end
module type S2 = sig .. end
type 'a thunk 

A function monad computation is a thunk that returns a value of type 'a.

include Monads.Std.Monad.Fun.S
module T1 (M : Std.Monad.Monad: sig .. end
module Make (M : Std.Monad.Monad: S 
        with type 'a t := 'a T1(M).t
         and type 'a m := 'a T1(M).m
         and type 'a e := 'a T1(M).e
module T2 (M : Std.Monad.Monad2: sig .. end
module Make2 (M : Std.Monad.Monad2: S2 
        with type ('a,'e) t := ('a,'e) T2(M).t
         and type ('a,'e) m := ('a,'e) T2(M).m
         and type ('a,'e) e := ('a,'e) T2(M).e