Module Exception


module Exception: sig .. end
Exception is a purely functional replacement of OCaml's built-in exceptions.

To indicate a normal value use Exception.return. For exceptional conditions use Exception.throw. Function Exception.catch splices in an exception handler into the thread of control. Execute an exception monad with Exception.run.


type ('a, 'b) t 
Type of an exception monad. 'left is the exception's type and 'right is the normal value's type.
val bind : ('a, 'b) t -> ('b -> ('a, 'c) t) -> ('a, 'c) t
bind a_monad a_function

Apply a_function to a_monad producing another monad. a_function takes a normal value as argument and returns a monad.

val return : 'a -> ('b, 'a) t
val throw : 'a -> ('a, 'b) t
val catch : ('a, 'b) t -> ('a -> ('c, 'b) t) -> ('c, 'b) t
val run : ('a -> 'b) -> ('c -> 'b) -> ('a, 'c) t -> 'b