(Will be streamed today, 2023-08-30, at 1830 UTC.)
9 Likes
Even for bare IO
, I find generalBracket
's ExitCode
type useful. When you have to perform a different action in case of exception than in case of normal exit, it’s much more convenient to pattern match on the ExitCode
than to do the mask
/ unmask
/ onException
dance.
I’ve build a small helper on top of generalBracket
called lazyGeneralBracket
. The idea is not to perform the actual allocation until the resource is accessed for the first time. And if the resource is never accessed, no allocation will take place!
1 Like
I think you mean ExitCase
1 Like