Abstract your representation and fix your functors
summary
Uses Haskell and the recursion-schemes library plus type families and Fix/Functor tricks to replace ad hoc recursion with composable F-algebras. Implements a comment-thread datatype with flags and recommends and builds stepwise functions: depth, total recommends, and net rating; those run by applying a catamorphism over the extracted base functor and terminate on finite data. Shows combining tiny algebras and using anamorphisms/apomorphisms/histomorphisms to avoid large refactors and enable rewrites and optimizations.
AI-written summary · about
chapters (6)
- 0:00Start
- 9:17Explicit Recursion
- 10:11Folding
- 13:58Recursion Schemes
- 17:48Finding the Depths of a Common Thread
- 28:58Review
related talks
29mIntroduction to Recursion Schemes
51mGoing bananas with recursion schemes for fixed point data types
56mAn introduction to recursion schemes
37mGoing bananas with recursion schemes for fixed point data types
38mRefactoring Recursion
01h 14mBeyond Free Monads
34mPeeling the Banana: Recursion Schemes from First Principles
47mHands on With Recursion Schemes - Part 1 of 2
