Intro
Category Theory looked scary when I first encountered it - a world of obscure nomenclature like endofunctors and Yoneda Lemma. Something that seemed reserved for the nerdiest programming language theorists, hardcore Haskellers, and near-schizophrenic mathematicians.
Earlier this year, I spent a couple hours watching youtube videos on it just so I could go from 0 (“I have no idea what it is but I have heard the name”) to 0.1 (“I still have no idea what it actually is, but I have a general idea of the main concepts”) and double-check my intuitions. What I found is a very addictive, immensely powerful mental model that applies to countless things both in CS but also in nearly everything else. It’s also fundamentally very fun to think about and do. I feel like mathematicians and computer scientists alike fall into it like a curious-minded kid falls into redstones and minecraft modding.
Around a month ago, I finally decided to commit and jump right in, my interest having been piqued by the first video linked below. Since then, I have accumulated many a talk paper and book and I wanted to have a place to stash it all and so here we are.
You can skip may ahead if you’re only interested in the resources.
Why It Grabbed Me
For me, Category Theory has been one of these things where, once you learn about it, you can literally see it everywhere. Everything starts looking like morphisms between objects and functors between categories. I have found the overwhelming majority of the ideas in it to be truly, deeply intuitive. It’s still a work in progress to have a real sense of how immensely powerful they are, and my definition of the “essence of category theory” is still getting new shades every week.
Overall, it did help me sank in two immensely important things, that were previously only intuitions: the power of abstraction and composition
I have started writing a lot more about abstraction and the expressive powers it enables to try and synthesize my thoughts. There are also some markdown with vague scribbles on composition and how fundamentally important it is. Lately I have been trying to also collect my thoughts on the why and what it is that I truly find attractive and useful a mental model of things about Category Theory and give meaningful examples by looking at the troves of FP concepts that have appeared since the 2010s in non-FP languages like Java, C++, JS, Python and with entire languages like Rust.
There’s lots more to say about how research in that field has poured into FP and then into OOP & imperative languages, how come it is so, and there are many more examples to give around: frontend frameworks, the growth in popularity of declarative languages or even in the complexity of distributed systems (etc…) and how all of these being are either influenced or can be interpreted in category theoretic ways.
However, I am no Gwern, and I intend to move off this bearblog ASAP and to my soon-to-be-ready forever home on the internet.
Resources
Youtube Intros / One-offs
- A Crash Course in Category Theory - Bartosz Milewski
- If you were to watch only one video, it should be the first 22 minutes of this one. If you are not deeply intrigued these first 22 minutes, maybe it isn’t time for your category theory arc just yet
- What did category theory ever do for us (functional programmers
- incredible pragmatic, down-to-business view of category theory from a FP programmer’s perspective
- Category Theory, The essence of interface-based design - Erik Meijer
- an incredible talk which gets a bit more into the weeds but remains a very pragmatic look at how category theory helps API and interfaces design
- “Categories for the Working Hacker” by Philip Wadler
- Category Theory by Tom LaGatta
- Applied Category Theory
- just a fun look at some applied category theory for curiosity’s and rabbit holes’ sake
Lectures
- Programming with Categories - Lecture 0
- this is by far the single best series
- The Language of Categories | Category Theory and Why We Care 1.1
- a very soft&light intro series to category theory, with plenty of analogies, animations etc…
Books
- Category Theory for Programmers - Bartosz Milewski The best introduction book, to accompany or lead the youtube series from Bartosz’ himself linked above. Clear language with lots of analogy and pragmatic programming-oriented approach to examples. Difficulty: 1/3
- Category Theory for Scientists - David I. Spivak Features the now famous relational database schemas example, it is to me the second nicest book on Category Theory, in that was the most second most easily digestible one and served (and still serves) as a great introduction to it. Difficulty: 1+/3
- An Introduction to Category Theory - Harold Simmons Accompanied with An Introduction to Category Theory (The Solutions) from the same author, it is a rigorous, format and straight to business introduction to category theory. Difficulty: 2/3
The following books, unlike the ones above, I have either not fully went through or only use to get different verbiage around concepts I am struggling with:
- Basic Category Theory - Tom Leinster (https://arxiv.org/pdf/1612.09375) Heavy, formal, full of signal. Difficulty: 2+/3
- Categories for the Working Mathematician - Saunders Mac Lane Also heavy, formal, full of signal. Difficulty: 2+/3
These ones I am eager to get started with and have, in an act of pure greed, already flicked through and read some parts of.
- An Invitation to Applied Category Theory (Seven Sketches in Compositionality) - Brendan Fong, David I. Spinak
- Category Theory for Computer Scientists - Benjamin C. Pierce
Random papers
On databases x category theory:
- Exploring Category-Theoretic Approaches to Databases
- Categorical Databases
- Exploring Category-Theoretic Approaches to Databases
On ML:
- Towards a Categorical Foundation of Deep Learning: A Survey - this one was linked to me on X! I have barely started reading it but shall devour it soon
- Robust Diagrams for Deep Learning Architectures: Applications and Theory (this one is incredibly long but fascinating although somewhat tangential – I actually saw these diagrams often on my TL but could barely read them and had no idea they were influenced by Category Theory)
- Backprop as Functor: A compositional perspective on supervised learning - incredibly interesting look at backpropagation as a monoidal functor
- Fundamental Components of Deep Learning: A category-theoretic approach - haven’t started reading it yet!