IO monad & Error management : From Exceptions to Cats MTL

By Guillaume Bogard

Elevator Pitch

Things always go wrong, we must deal with it. This talk is a journey of error management, from good ol’ Exceptions to error handling in purely functional programs using Cats MTL. Along the way, we’ll talk about separating business errors from technical failures for cleaner, business-driven programs.

Description

Every application is prone to failure, even the “purely functional” ones. Many Scala developers use IO monads to encode side-effects in an attempt to make them let hazardous than they are, but the error handing mechanisms that the most popular IOs provide are somewhat limited. In this journey in the world of error management, we’ll talk about what these mechanisms are what better alternatives the Cats ecosystem gives us. We’ll go from raising and recovering good old Exceptions to harnessing the full power of monad transformers with Cats MTL. Along the way, will emphasize the importance of separating technical failures from business concerns and see how Scala’s type system allows us to model meaningful domain errors and handle them exhaustively.

Notes

This is talk I already gave in french at a local functional programming meetup recently (slides are here). It has been well received, even by people not doing Scala. My goal is to improve on the feedback I was given then to make it better. I’d like to improve the code examples especially.

As for the technical requirements, a little understanding of what an IO monad is is better, but I don’t expect people to have prior experience with monad transformers or Cats MTL.