Hands on With Recursion Schemes - Part 2 of 2
summary
Live coding shows Scala + Matryoshka recursion schemes producing working results: an eval algebra yields Either division‑by‑zero or Int and evaluates to 7 then to a division‑by‑zero error; cataM and Traverse implement effectful folds; a collect cata returns a List of NumLit nodes; an ana-based gen tries to build an expression of a given complexity (partial demo); para is used to return the original sub‑AST on division errors; Cofree is shown for Cofree annotations and Scala Matryoshka with cataM and ana and para to get original AST.
AI-written summary · about
chapters (15)
- 0:00Recursion schemes intro
- 0:34Implementing eval with Katam
- 5:28Fixing Scala inference
- 6:36Traverse for expression types
- 10:20Evaluating expressions with Katam
- 11:09Collect nodes of type
- 16:11Implementing unfold with Jen
- 26:29Recursion vs manual traversal
- 28:41Understanding Fix and unfix
- 33:18Implementing cata from scratch
- 34:22Moving beyond cata to para
- 38:58CoFree for annotations
- 41:05Extending language with let
- 49:03Scope challenges in recursion
- 51:21Summary and Q&A
related talks
44mType level Computations in Scala
44mTelling the Truth with Types
54mRoll Your Own Shapeless
55mThe Shape of Shapeless (Part 2)
22mTransformation Function Called Higher-Order
48mA gentle introduction to type level programming in Scala
34mFree All The Things
43mA Deep Dive into Advanced TypeScript: A Live Coding Expedition
