Module Monad.Make2

Make2(M) derives Monad.S2 from the Basic implementation

Parameters

module M : Basic2

Signature

val void : ( 'a, 'e ) M.t -> ( unit, 'e ) M.t

void m computes m and discrards the result.

val sequence : ( unit, 'e ) M.t list -> ( unit, 'e ) M.t

sequence xs computes a sequence of computations xs in the left to right order.

val forever : ( 'a, 'e ) M.t -> ( 'b, 'e ) M.t

forever xs creates a computationt that never returns.

module Fn : sig ... end

Various function combinators lifted into the Kleisli category.

module Pair : sig ... end

The pair interface lifted into the monad.

module Triple : sig ... end

The triple interface lifted into a monad.

module Lift : sig ... end

Lifts functions into the monad.

module Exn : sig ... end

Interacting between monads and language exceptions

module Collection : sig ... end

Lifts collection interface into the monad.

module List : Collection.S with type 'a t := 'a list

The Monad.Collection.S2 interface for lists

module Seq : Collection.S with type 'a t := 'a Core_kernel.Sequence.t

The Monad.Collection.S2 interface for sequences

include Syntax.S2 with type ('a, 'e) t := ( 'a, 'e ) M.t
val (>>=) : ( 'a, 'e ) M.t -> ( 'a -> ( 'b, 'e ) M.t ) -> ( 'b, 'e ) M.t

m >>= f is bind m f

val (>>|) : ( 'a, 'e ) M.t -> ( 'a -> 'b ) -> ( 'b, 'e ) M.t

m >>= f is map m ~f

val (>=>) : ( 'a -> ( 'b, 'e ) M.t ) -> ( 'b -> ( 'c, 'e ) M.t ) -> 'a -> ( 'c, 'e ) M.t

f >=> g is fun x -> f x >>= g

val (!!) : 'a -> ( 'a, 'e ) M.t

!!x is return x

val (!$) : ( 'a -> 'b ) -> ( 'a, 'e ) M.t -> ( 'b, 'e ) M.t

!$f is Lift.unary f

val (!$$) : ( 'a -> 'b -> 'c ) -> ( 'a, 'e ) M.t -> ( 'b, 'e ) M.t -> ( 'c, 'e ) M.t

!$$f is Lift.binary f

val (!$$$) : ( 'a -> 'b -> 'c -> 'd ) -> ( 'a, 'e ) M.t -> ( 'b, 'e ) M.t -> ( 'c, 'e ) M.t -> ( 'd, 'e ) M.t

!$$$f is Lift.ternary f

val (!$$$$) : ( 'a -> 'b -> 'c -> 'd -> 'e ) -> ( 'a, 's ) M.t -> ( 'b, 's ) M.t -> ( 'c, 's ) M.t -> ( 'd, 's ) M.t -> ( 'e, 's ) M.t

!$$$$f is Lift.quaternary f

val (!$$$$$) : ( 'a -> 'b -> 'c -> 'd -> 'e -> 'f ) -> ( 'a, 's ) M.t -> ( 'b, 's ) M.t -> ( 'c, 's ) M.t -> ( 'd, 's ) M.t -> ( 'e, 's ) M.t -> ( 'f, 's ) M.t

!$$$$$f is Lift.quinary f

include Syntax.Let.S2 with type ('a, 'e) t := ( 'a, 'e ) M.t
val let* : ( 'a, 'e ) M.t -> ( 'a -> ( 'b, 'e ) M.t ) -> ( 'b, 'e ) M.t

let* r = f x in b is f x >>= fun r -> b

val and* : ( 'a, 'e ) M.t -> ( 'b, 'e ) M.t -> ( 'a * 'b, 'e ) M.t

monoidal product

val let+ : ( 'a, 'e ) M.t -> ( 'a -> 'b ) -> ( 'b, 'e ) M.t

let+ r = f x in b is f x >>| fun r -> b

val and+ : ( 'a, 'e ) M.t -> ( 'b, 'e ) M.t -> ( 'a * 'b, 'e ) M.t

monoidal product

include Core_kernel.Monad.S2 with type ('a, 'e) t := ( 'a, 'e ) M.t
val (>>=) : ( 'a, 'e ) M.t -> ( 'a -> ( 'b, 'e ) M.t ) -> ( 'b, 'e ) M.t
val (>>|) : ( 'a, 'e ) M.t -> ( 'a -> 'b ) -> ( 'b, 'e ) M.t
module Let_syntax : sig ... end
module Monad_infix : sig ... end
val bind : ( 'a, 'e ) M.t -> f:( 'a -> ( 'b, 'e ) M.t ) -> ( 'b, 'e ) M.t
val return : 'a -> ( 'a, 'b ) M.t
val map : ( 'a, 'e ) M.t -> f:( 'a -> 'b ) -> ( 'b, 'e ) M.t
val join : ( ( 'a, 'e ) M.t, 'e ) M.t -> ( 'a, 'e ) M.t
val ignore_m : ( 'a, 'e ) M.t -> ( unit, 'e ) M.t
val all : ( 'a, 'e ) M.t list -> ( 'a list, 'e ) M.t
val all_unit : ( unit, 'e ) M.t list -> ( unit, 'e ) M.t
module Let : Syntax.Let.S2 with type ('a, 'e) t := ( 'a, 'e ) M.t

Monadic Binding Operators.

module Syntax : Syntax.S2 with type ('a, 'e) t := ( 'a, 'e ) M.t

Monadic operators, see Monad.Syntax.S2 for more.