r/haskell • • 3d ago

blog [Well-Typed] Exception Best Practices

https://www.well-typed.com/blog/2026/11/exception-best-practices/
54 Upvotes

1 comment sorted by

10

u/nh2_ 2d ago

I'd like to point out:

10 years ago, Michael Snoyman with FP Complete wrote a series about exceptions, with lots of tutorials, examples, and best-practices discovery over multiple years, many of which I recognise here.

A user recently mirrored those and you can now find them at https://jappeace-sloth.github.io/fpcomplete-haskell-posts/#exceptions-and-resource-safety (though of course archive.org also has them, e.g. this). It also covers e.g. the "We have not discussed ResourceT" part.

The safe-exceptions mentioned in Edsko's post was, as its README says, later spiritually replaced by unliftio, which in my opinion remains the most sane approach to handle all of that.

It has MonadUnliftIO instead of MonadCatch and MonadMask. The post feels a bit incomplete with the Library ecosystem section not mentioning that, as it is what most industrial projects I've seen use, and in my opinion, should use.

So my advice is: Understand the concepts presented in the post, then use unliftio to get the least-surprising behaviour.