A roadtrip with monads: from MTL, through tagless to BIO
summary
A small Scala program composes console, third‑party weather client and a cache into an ask–fetch–judge loop that compiles and runs. It uses Monix Task with ScalaZ shims, starts as an EitherT/ReaderT/StateT transformer stack (functionally correct but about an order‑of‑magnitude slower), then refactors to tagless final algebras (console, weather, monad‑state) so code stays composable, becomes easily testable with mock instances, and can regain near‑imperative speed by choosing a bifunctor IO/ZIO or concrete effect.
AI-written summary · about
chapters (8)
- 0:00Introduction to FP Example
- 10:39Initial Implementation Issues
- 12:23Adopting the MTL Pattern
- 18:53Tagless Final Approach
- 22:10Testing and Running the App
- 26:05Performance Challenges
- 29:48Optimizing Performance
- 32:53Advanced Error Handling
related talks
38mA roadtrip with monads: from MTL, through tagless, to BIO
31mThe Eff monad, one monad to rule them all
42mMonads you already use without knowing it
35mThe Functor, Applicative, Monad talk
46mOptimusPrimeT
33mAnalyzing Functional Programs
44mIO monad & Error management: From Exceptions to Cats MTL
26mUP YOUR MTL GAME WITH CLASSY OPTICS
