A Gentle Introduction to Comonads
summary
Claims that comonads let pure code inspect and transform values with their surrounding context; implements a Comonad instance for a 2D FocusGrid where extract returns the focused cell and coflatMap enumerates every focus. Uses the Cats library, builds a box blur (5×5 radius), mirror and a Conway’s Game of Life step, composes them, and ports the code to Scala.js to run animated in the browser; works interactively and is reasonably efficient because underlying arrays are shared by reference.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:06Pure functional programming
- 5:08Functors and monads
- 10:37Comonads explained
- 16:23Practical comonad example
- 21:13Image processing demo
- 22:42Live coding demo
- 23:10Q&A
related talks
42mMonads you already use without knowing it
18mEasy, intuitive, direct-style syntax for Monad-comprehensions!
33mFunctional Patterns and Gems in Scala
55mMonoids, Monoids, Monoids
43mFunctional Programming with Effects
31mThe Eff monad, one monad to rule them all
21mGaticos & Monads
51mThe Hills Are Alive With the Sound of Comonads
