Recursion schemes are elegant and useful patterns for expressing general computation. In particular, they allow you to ‘factor recursion out’ of whatever semantics you may be trying to express when interpreting programs, keeping your interpreters concise, your concerns separated, and your code more maintainable.
...
In this article I want to avoid building up the machinery meticulously and instead concentrate mostly on understanding and using [medium.com] Edward Kmett’s recursion-schemes library [haskell.org], which, while lacking in documentation, is very well put together and implements all the background plumbing one needs to get started.In particular, to feel comfortable using recursion-schemes I found that there were a few key patterns worth understanding:
--Factoring recursion out of your data types using pattern functors and a fixed-point wrapper.
--Using the ‘Foldable’ & ‘Unfoldable’ classes, plus navigating the ‘Base’ type family.
--How to use some of the more common recursion schemes out there for everyday tasks.