To conclude this series of articles, I’d like to point out that I delivered on the promise I made in the introduction.
I told you that you’d understand the purpose of recursion schemes. And you do! Each one of them is a different, common recursive pattern, that has been generalised as far as it could be - and then a little bit further. Recursion schemes are Design Patterns for recursion.
I also told you that you’d have the tools to study all the others by yourselves. And you do! Once you understand pattern functors and how they’re used to represent partially solved problems, you’ve got everything you need. Simply take a recursive pattern and try and stick your pattern functor into it, and before too long you’ll have a proper recursion scheme.
And of course, I’ve given you one further, very important tool: Fix
- in that, you should not use it. If you ever find yourself reading an article telling you that before you can understand this specific scheme, you need to learn about Fix
, just… close the tab. This little piece of advice would have saved me hours of sweat and tears.
At this point, I believe my work here is done. I dub thee all proper functional programmers, and bid you a good day.