Monoids, Monads, and Applicative Functors: Repeated Software Patterns
summary
Shows concrete C++ implementations: treat std::vector, std::optional and std::function as monoids/functors and implement std::optional monoid and parser applicative with pure/apply/join. Claims monoids give lock-free, highly parallel map-reduce style composition (n-heap merges across cluster nodes), functors let you map through nested containers, applicatives propagate errors or model non-determinism, and monads add sequencing via join. Provides a working parser built from these primitives (start-char optimization) and argues it is competitive and composable with real C++ code.
AI-written summary · about
chapters (12)
- 0:00Introduction to patterns
- 1:09Why functional design matters
- 2:32History of Haskell and category theory
- 6:09Understanding monoids
- 15:16Exploring functors
- 20:34Applicative functors explained
- 25:50Applicative functors in practice
- 33:19Building parser with applicatives
- 34:21Monads and their power
- 37:34Monads in C++ and real-world use
- 38:39Wrap-up and future patterns
- 39:01Q&A session
related talks
01h 16mFunctional Composition Beyond Monads
01h 03mMonads in Modern C++
29m“Functional programming: functors and monads"
35mThe Functor, Applicative, Monad talk
01h 14mBeyond Free Monads
01h 06mThe Functional Programmer's Toolkit
01h 47mFunctional C++
01h 18mSafe and Readable C++ Code: Monadic Operations in C++23
