Intro to FP in Scala: Exploring a Toolbox for Solving Problems - Part 5 of 6
summary
Part of a hands‑on Scala FP workshop that implements a concrete solution: state monad implemented from scratch and then used to replace hand‑rolled s -> (s, A) functions. Code shows map/flatMap, wrapping functions, and a cache-as-immutable-map user repo example where get/insert/repo return State and a for‑comprehension passes state for you. Tests run the State via run, expose the previous bug of manually threaded state, and demonstrate a working pattern; no slides provided.
AI-written summary · about
chapters (18)
- 0:00Intro
- 2:14Modularity
- 6:11File
- 9:30Repository
- 11:43Cash
- 12:49Caches
- 14:01State Type
- 15:30Implementing State
- 17:33State parameterisation
- 20:05Map function example
- 23:29Skite
- 24:57Following types
- 25:48Flat map
- 27:07State
- 28:50State monad
- 29:59State functions
- 31:45For comprehension
- 34:12Run








