finally package:streamly

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
Like finally with following differences:
  • action m b won't run if the stream is garbage collected after partial evaluation.
  • does not require a MonadAsync constraint.
  • has slightly better performance than finally.
Inhibits stream fusion Pre-release