A context in which exceptions can be caught and thrown.
This class places no other class constraints on F, but it should be the
case that exceptions raised via fail are caught by the nearest surrounding
attempt and returned as a Left. In addition to catching explicitly
raised exceptions via fail, we expect that attempt catch ambient
exceptions that might occur when 'evaluating' an F.
We can state the requirement that attempt catch all ambient exceptions
by stipulating that for all total functions of the form
g: forall A . F[Throwable \/ A] => B, g compose attempt is also
total.
A context in which exceptions can be caught and thrown.
This class places no other class constraints on
F
, but it should be the case that exceptions raised viafail
are caught by the nearest surroundingattempt
and returned as aLeft
. In addition to catching explicitly raised exceptions viafail
, we expect thatattempt
catch ambient exceptions that might occur when 'evaluating' anF
.We can state the requirement that
attempt
catch all ambient exceptions by stipulating that for all total functions of the formg: forall A . F[Throwable \/ A] => B
,g compose attempt
is also total.