6 Structuring programs with monad transformers
This chapter covers
- Using monad transformers to extend monad functionality
- Describing an application structure with monad stacks
- Defining monad transformers
- Overview of the most common monad transformers provided by the Haskell libraries
We’ve seen many monads already. We know that every monad specifies a way to combine two computations in a sequence by implementing the >>=
operator. We also know that in a monadic setting we have a result of a computation with some additional effects: computations may fail (as in the Maybe
monad) or give an opportunity to communicate with the real world by doing input and output (as in the IO
monad), or we may mutate the state or consult an environment in some ...
Get Haskell in Depth now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.