April 22, 2026
Do or do not? There is only do
Effectful Recursion Schemes
New code trick has devs chanting "do do do"
TLDR: A new Effekt demo shows how to replace complex nested types with simple “requests” and handlers to fold data cleanly. Early commenters fixated on the “do do do” style—some charmed by its clarity, others wary of readability—setting up a classic power-vs-practicality showdown that could reshape how functional code is written.
A brainy new post from Marvin Borner shows how to do a classic computer-science move—“folding” a data structure into a result—using effects and handlers instead of the usual deep, twisty types. Translation: instead of building an endless Russian-doll of shapes, the code sends simple “requests” (like sym, lam, app) and a handler answers them, stitching together the final string. The blog even turns the lambda-calculus identity function into a neat demo and drops a trick question about why a “not implemented” error vanishes. Answer: you hand values back with a special “resume” button. It’s interactive, too, so you can poke it and watch it work.
But the community’s eyes locked onto the style. One early reaction links to Effekt’s docs and basically says: look at this syntax—a dramatic staircase of “do” calls like this. Cue the memes: “how many ‘do’s until it compiles?” The vibe is equal parts curious and skeptical. Some see a power move—clear, explicit steps you can rearrange. Others worry it’s readability roulette, especially when “resume” hops control around. While it’s early days with just a nibble of comments, the mood is set: clever technique, loud “do do do” aesthetic, and a looming debate over whether this is the future of clean, composable code or a new flavor of spaghetti with better math. Expect fireworks as more folks weigh in.
Key Points
- •The article demonstrates implementing catamorphisms using effects and handlers in the Effekt language.
- •Effekt lacks support for infinite types, so it replaces functor-based base functors with a refunctionalized effect interface (TermF[T,R]).
- •A lambda-term data type (Sym, Lam, App) is used to show conventional recursion versus effectful catamorphism.
- •Effect operations (sym, lam, app) are handled with try/with and resume to supply results to the computation.
- •A generic cata function (A / TermF[A,A]) enables rewriting pretty-printing as a fold via an effect handler.