Practical uses of catamorphisms: where do you learn from?

I’ve been going through the catamorphisms series from Brian (which is all I can see for his name) and these blog posts are fantastic. There are similar series from fsharpforfunandprofit etc but the reason I really like these posts is because they address more real life concerns one would discover if they were to use catamorphisms than others.

Such as: how to avoid copying a whole tree, how to avoid traversing the whole tree, etc etc…

This is the essence of my question: how do you learn these type of methods? The web is full of blog posts, which either get obsessed with relating the topic to category theory, or leave it at a simpler level than what would be helpful when implementing potentially production code. I must insist I have no intention of starting a discussion about the usefulness of category theory, that’s just not what I’m seeking.

So especially what books, if any, provide the type of hints and guidance Brian’s posts are offering? I’d also ask Brian where and how he/she learned it from if I had a means of communication, but I’m hoping this community may have some members to guide me.

The resources can be in Haskell, OCaml etc, as long as they provide that valuable real life advice.


Just in case it helps someone: the most pragmatic advice I got on this from other channels have been “recursion schemes”.

Using the recursion schemes as the search criteria brings some fascinating stuff. In case anybody stumbles into this page via a Google search.

Hi @SerefArikan !

You pose a very good question. How should one learn all the techniques that are available? I’ve studied blog posts such as this one (didn’t read all of it, but Brian does write well IMO too!). I’ve come to a conclusion that there is no substitute from using the programming language actively. Try to solve problems with F# and try to solve them elegantly. I think this is the best way. I haven’t used catamorphisms (yet), but I now now enough about them to know that if I have a problem that involves a tree-like structure that I want to “fold over”, I now know how to find the elegant solution.
I don’t think trying these solutions before you have a problem is a very good way. The reason being that without having your own problem to solve, it will remain an academic excercise rather than a practical problem solving tool. This is my take, yours might be different :slight_smile:
So conclusion: get started with F# and try to solve your programming challenges with it!
Good luck :slight_smile: