How to reduce code duplication when dealing with recursive sum types
Congratulations, you just rediscovered anamorphisms! Here’s your code, rephrased so that it works with the recursion-schemes package. Alas, it’s not shorter, since we need some boilerplate to make the machinery work. (There might be some automagic way to avoid the boilerplate, e.g. using generics. I simply do not know.) Below, your recurseAfter is replaced with … Read more