A monad is an abstraction of the concept of sequencing of computations. A value of type 'a monad represents a computation that returns a value of type 'a.
return v
returns the (trivial) computation that returns v.
ok_unit = return ()
try_with f
catches exceptions thrown by f
and returns them in the Result.t as an
Error.t. try_with_join
is like try_with
, except that f
can throw exceptions or
return an Error
directly, without ending up with a nested error; it is equivalent to
try_with f >>| Result.join
.
The option extract_exn
is passed along to Monitor.try_with ?extract_exn
and
specifies whether or not the monitor exn wrapper should be skipped (extract_exn:true
or kept (extract_exn:false
).