The Free Monad by Example
summary
A working Free-monad DSL for stream processing that represents programs as step/emit/await/stop instructions, with combinators such as pipe, compile and repeat plus a collector to turn a Process into a List. It demonstrates fusion of map/filter and explains that the separation of representation and interpretation makes testing possible by inspecting the Free structure, but warns of JVM overhead (many short-lived objects) and that naive flatMap can be quadratic without optimizations; real workloads still run and optimized Free variants exist.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 1:18Speaker and topic
- 3:31What is Free
- 4:35Representation vs interpretation
- 6:01Free structure
- 7:26Trampolines example
- 13:24Functors and monads in Free
- 16:13Stream processing with Free
- 23:46Adding logic to representation
- 25:09P combinator and interpretation
- 27:58Pipe and Filter example
- 31:59DSL and Free conclusion
- 34:30Performance and optimization
- 38:55When to use Free
- 40:43Q&A
related talks
42mThe Monad and You
31mMONADS - CODING FUNCTIONALLY
01h 03mFunctional Programming Patterns for Mere Mortals
41mCofree Comonads and their Uses
34mThe circuit as a point-free general model of computation
33mJourney to the Heart of the For-Yield
01h 35mRecursion Schemes, Algebras, Finally Tagless, Data Types
26mInfinite Possibilities
