Using Monad Transformers without understanding them
summary
Explains how to drop manual boxing and use ExceptT, ReaderT, and StateT to add errors, read-only config, and mutable state to existing monads, with runnable PureScript examples in a repo. Shows concrete bind/run functions, provides ask/get/put/throwError/catchError helpers, and demonstrates stack-order difference: ExceptT stacked over StateT drops state on error while StateT over ExceptT preserves it. Covers Tagless Final as an encoding and includes code to run each transformer variant.
AI-written summary · about
chapters (11)
- 0:00Introduction to monads
- 1:06What problems do monads solve
- 5:01Limitations of basic monads
- 6:17Understanding transformers
- 8:46The problem of manual nesting
- 12:40ExceptT transformer
- 14:54ReaderT transformer
- 16:52StateT transformer
- 19:02Using transformers effectively
- 20:46Stack order and monads
- 23:11Conclusion and resources
related talks
01h 07mMonad transformers are good, actually
47mMonad transformers down to earth
44mIO monad & Error management: From Exceptions to Cats MTL
34mMonad Transformer State
42mMonads you already use without knowing it
35mThe Functor, Applicative, Monad talk
32mExtending your HTTP library with monad transformers
38mA roadtrip with monads: from MTL, through tagless, to BIO
