Make.Exn
Interacting between monads and language exceptions
val expect :
?finally:(unit -> unit T1(T)(M).t) ->
f:(unit -> 'a T1(T)(M).t) ->
catch:(exn -> 'a T1(T)(M).t) ->
'a T1(T)(M).t
expect ?finally ~f ~catch
evaluates f ()
, if an exception e
is raised during the evaluation (or call) then the result of whole computation will be catch e
. If an optional argument ?finally
is passed the finally
is called after f ()
computation or after catch e
if an exception was raised.