module Exception:sig..end
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 ('left, 'right) t
'left is the exception's type and
'right is the normal value's type.val bind : ('left, 'right) t ->
('right -> ('left, 'new_right) t) ->
('left, 'new_right) tbind 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 : 'right -> ('left, 'right) treturn a_normal_value
Answer a_normal_value.
val throw : 'left -> ('left, 'right) tthrow an_exception
Answer an_exception, or in other words, throw an_exception.
val catch : ('left, 'right) t ->
('left -> ('new_left, 'right) t) -> ('new_left, 'right) tcatch a_monad an_exception_handler
Catch exceptions from a_monad and feed them into
an_exception_handler. an_exception_handler takes an
exceptional value as argument and returns a monad.
val run : ('left -> 'a) -> ('right -> 'a) -> ('left, 'right) t -> 'arun a_failure_function a_success_function a_monad
Run a_monad. If a_monad does not Exception.throw an
exception, pass the result of evaluating the monad to
a_success_function. Otherwise, if the a_monad throws, pass
the exception to a_failure_function.