Module type Monad.S_with_product

Monad signature with product

In a computational point of view, a monad is an abstraction of a sequence of operations. But sometimes, one may need to specify that two operations can be performed in *any* order, for instance when dealing with concurrency or generic errors handling using the option type. To do so, one needs a *product* on monadic values, i.e a way to combine two monads into a new one. Thus a second signature is provided, including a product operator and the two let-bindings and* and and+.

type 'a t
val return : 'a -> 'a t
val flatten : 'a t t -> 'a t
val map : ('a -> 'b) -> 'a t -> 'b t
val bind : ('a -> 'b t) -> 'a t -> 'b t
val product : 'a t -> 'b t -> ('a * 'b) t
module Bool : sig ... end
module Option : sig ... end
module List : sig ... end
module Operators : sig ... end