finally
A specialised variant of
bracket with just a computation to run
afterward.
Perform an action with a finalizer action that is run, even if an
error occurs.
Perform
thing, guaranteeing that
after will run
after, even if an exception occurs.
Same interruptible vs uninterrupible points apply as with
bracket. See
base's
finally for more
information.
Generalized version of
finally.
Note, any monadic side effects in
m of the "afterward"
computation will be discarded.
Like
bracket, but for the simple case of one computation to run
afterward.
Analogous to
finally from
Control.Monad.Catch, except
this also protects against premature termination
Deprecated: Use Control.Monad.Catch.finally instead
Run the action
m b whenever the stream
Stream m a
stops normally, aborts due to an exception or if it is garbage
collected after a partial lazy evaluation.
The semantics of running the action
m b are similar to the
cleanup action semantics described in
bracket.
>>> finally action xs = Stream.bracket (return ()) (const action) (const xs)
See also finally_
Inhibits stream fusion
Run the action
m b whenever the stream
t m a stops
normally, aborts due to an exception or if it is garbage collected
after a partial lazy evaluation.
The semantics of running the action
m b are similar to the
cleanup action semantics described in
bracket.
See also finally_
Inhibits stream fusion
Unfold the input
a using
Unfold m a b, run an action
on
a whenever the unfold stops normally, aborts due to an
exception or if it is garbage collected after a partial lazy
evaluation.
The semantics of the action
a -> m c are similar to the
cleanup action semantics in
bracket.
finally release = bracket return release
See also finally_
Inhibits stream fusion
Pre-release
Run a computation and always perform a second, final computation even
if an exception is raised. If a short-circuiting monad transformer
such as ErrorT or MaybeT is used to transform a MonadException monad,
then the implementation of finally for the transformed monad
must guarantee that the final action is also always performed when any
short-circuiting occurs.
We need to be able to terminate benchmarking in case of an exception.
Finally for the Error class. Errors in the finally part take
precedence over prior errors.
Like
bracket, but for the simple case of one computation to run
afterward.
Run an action and then, run a finalizer afterwards. The second action
will run whether or not an exception was raised by the first one. This
is like
bracket above, but can be used when you know you have
cleanup steps to take after your computation which
do have to
be run even if (especially if!) an exception is thrown but that that
cleanup doesn't depend on the result of that computation or the
resources used to do it. The return value
γ of the subsequent
action is ignored.
Generalized version of
finally. Note, any monadic side effects
in
m of the "afterward" computation will be discarded.
finallyE a b executes computation
a followed
by computation
b, even if
a exits early by throwing
an exception. In the latter case, the exception is re-thrown after
b has been executed.