Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The main problem is that category theorists keep writing stuff claiming that, if only you get through the math, you'll eventually be able to apply the category theory to typical everyday programming problems. And by the time they get to the Yoneda lemma or whatever, they've forgotten they're supposed to show some applications. All they show is how to express category theoretical concepts in a program. And it is mostly because the demonstrated applications are few (I have spent a lot of time looking and have found little convincing evidence).

Having learned the subject myself, I'm not convinced it's useful for programmers. Hell, it's not even useful for all areas of mathematics, and that is its raison d'etre.



I often go back to this post by John D Cook. Quote below: https://www.johndcook.com/blog/applied-category-theory/

    Category theory can be very useful, but you don’t use it the same way you use other kinds of math. You can apply optimization theory, for example, by noticing that a problem has a certain form, and therefore a certain algorithm will converge to a solution. Applications of category theory are usually more subtle. You’re not likely to quote some theorem from category theory that finishes off a problem the way the selecting an optimization algorithm does.

    I had been skeptical of applications of category theory, and to some extent I still am. Many reported applications of category theory aren’t that applied, and they’re not so much applications as post hoc glosses.

    At the same time, I’ve seen real applications of categories, such as the design of LINQ mentioned above. I’ve been a part of projects where we used category theory to guide mathematical modeling and software development. Category theory can spot inconsistencies and errors similar to the way dimensional analysis does in engineering, or type checking in software development. It can help you ask the right questions. It can guide you to including the right things, and leaving the right things out.

Category theory in LINQ

https://queue.acm.org/detail.cfm?id=2024658


This two-part keynote might give you a good flavour:

* https://www.youtube.com/watch?v=4WMfKhKKVN4

* https://www.youtube.com/watch?v=zooYfk5-yPY

If you can stand up a Cartesian-closed category, it is a model of a lambda calculus. So you can make a compiler plugin that takes lambda terms (a large subset of Haskell) and compiles it into all sorts of exotic settings (dataflow diagrams, derivatives of the function, ...)

KittyHawk used it to compile Haskell to C in https://github.com/sellout/compiling-anything-to-categories and someone talks about their work here: https://www.youtube.com/watch?v=VUBj8NW7uMA


> Having learned the subject myself, I'm not convinced it's useful for programmers.

I think it is demonstrably useful to people who design programming languages with strong type systems. Not a very common use case in practice, but it did find an application. Damned with faint praise, perhaps. I haven't seen anyone demonstrate a use outside that niche.


I've been down that rabbit hole, and while some few select people do it, the vast majority of people doing this rely on PL papers that long preceded the attempt to put category theory in the mix.


What's the application of languages with strong type systems?

Some people do the work of learning category theory and still decide in the end to write lint.


> The main problem is that category theorists keep writing stuff claiming that, if only you get through the math, you'll eventually be able to apply the category theory to typical everyday programming problems.

There is no "typical everyday programming problems." It's an incredibly broad discipline, and one person's typical is another's esoteric.

When you're designing an API, it's useful to know when you're dealing with one of the common structures that occurs in category theory, and there's a somewhat high cost to missing that, since you can end up with a "broken" feeling API where the pieces don't fit together properly, or where the different parts aren't consistent with one another.


I'm interested in reading about the application of Category Theory to API design.


The only practical use I have found for knowing some category theory, is to be able to decode what your FP fanatic colleague is talking about.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: