Software Engineer, Adam McCullough has a solution for you! Monad transformers allow developers to compose the effects of different monads, find out more in this talk Adam gave at LambdaConf 2018.
Monad Transformers for the Easily Confused
Monads are not composable. This poses a problem, since composition is one of the foremost patterns in functional programming. However, many alternatives have been devised. One of the most common is the monad transformer.
Monad transformers allow developers to compose the effects of different monads, even if the monads themselves are not the same. An example is writing a do-statement that can: abort computation (ExceptT), thread state (StateT), and connect to a database (via a Haskell library such as persistence or esqueleto).
The transformers package is used by over 2,500 packages on Stackage. But using monad transformers is a challenge for many, even if they are already writing useful, effectful, production Haskell.
This talk hopes to de-mystify monad transformers by giving both theoretical and practical code examples. We will start with small examples, to develop an intuition for how they work, and evolve that understanding until we are working with a functional web app that talks to a SQLite back end.