Module Monad.Choice

A choice monad interface.

A choice monad is a monad with an exceptional control flow, akin to the Fail monad, except that it may not hold an additional error information. In exchange several control flow operators are provided. Basically, a choice computation may have zero or one result.

Example:

let sqrt x =
  guard (x > 0.) >>| fun () ->
  sqrt x

Implemented by:

module type Basic = sig ... end

The minimal choice interface for unary monad.

module type S = sig ... end

The unary choice monad interface

module type Basic2 = sig ... end

The minimal choice interface for binary monad.

module type S2 = sig ... end

The binary choice monad interface

module Make (M : Basic) : S with type 'a t := 'a M.t
module Make2 (M : Basic2) : S2 with type ('a, 'e) t := ('a, 'e) M.t