Composable concurrency with Ref + Deferred
summary
fs2 builds concurrency from two primitives: Ref.modify as an atomic CAS-based state transition that returns a result (so you can queue an effect to run after the state change), and Deferred one-shot for semantically blocking waits. The talk shows a concrete cache with single‑flight fetch that uses Ref+Deferred so concurrent gets deduplicate work and expire values, explains the CAS retry tradeoffs and shows interruption is tricky — solved by using guarantee to restore state and completing stuck waiters.
AI-written summary · about
chapters (16)
- 0:00Intro
- 1:15History
- 1:57Ref
- 5:00Race Condition
- 6:50Updates
- 10:26Deferred API
- 13:56What if it fails
- 16:42Why this way
- 18:26Modify
- 20:24Cache
- 21:58State
- 25:38Fetch
- 27:42Interrupt
- 29:22Restore State
- 31:20Guarantee State
- 33:38Questions
related talks
30mCONQUERING CONCURRENCY WITH FUNCTIONAL PROGRAMMING
39mShared State In Pure Fp When A State Monad Won't Do
36mATOMICALLY { DELETE YOUR ACTORS }
30mWhat Referential Transparency can do for you
34mThe Art of Functional State Management
36mFunctional Rust: From ADTs to Advanced Concurrency
36mConcurrent ML - The One That Got Away
39mConcurrent Languages are Functional
