A Categorical Manifesto
Posted by John Baez
A while back Gina asked why computer scientists should be interested in categories. Maybe you categorical computer scientists out there have your own favorite answers to this? I’d be glad to hear them. To get you going, here’s one man’s answer:
-
Joseph Goguen, A categorical manifesto, Mathematical Structures in Computer Science 1 (1991), 49-67.
Abstract: This paper tries to explain why and how category theory is useful in computing science, by giving guidelines for applying seven basic categorical concepts: category, functor, natural transformation, limit, adjoint, colimit and comma category. Some examples, intuition, and references are given for each concept, but completeness is not attempted. Some additional categorical concepts and some suggestions for further research are also mentioned. The paper concludes with some philosophical discussion.
Joseph Goguen was a professor of computer science at U. C. San Diego. He died on July 3rd, 2006, shortly after his 65th birthday.

Re: A Categorical Manifesto
For me, two of the most interesting aspects of category theory in computer science have been monads and generalised folds/unfolds.
If M is a functor that happens to be monad, then given an arrow (ie. a function because we’re working in the category of types and functions) A->MB and an arrow B->MC we can compose them to make an arrow A->MC, even though the tail of the first arrow is incompatible with the head of the second. This pattern is incredibly common when programming, especially in functional programming languages. Rather than have to write the glue to compose these functions over and over again, monads give a really nice way to express the glue and simplify the composition. And to grasp monads it really helps to understand some category theory, after all, they are categorical constructs.
Folds are a ubiquitous operation in computing. A fold is easiest to understand by example. Given an ordered list of numbers [1,2,3,4] we can turn it into an expression 1+2+3+4+0. We put a + between each pair of values and a value at the end (often the identity for +). Clearly we can generalise to any binary operator and any ‘end’ value. This is a fold and clearly summing a list is an example of one (and you have to admit, summing a list is a pretty ubiquitious operation). Many (all?) functions of lists can be expressed as folds so understanding folds gives a nice way to abstract your code to see commonality between different algorithms. Additionally, folds generalise to many datastructures besides lists. To fully grasp this needs a little category theory and the notion of an F-algebra.
And the fun thing is that as soon as we view this stuff through category theory it becomes clear that these notions have duals. On the one hand we find comonads, and on the other we find F-coalgebras and unfolds. It turns out that many algorithms are naturally structured via comands and that unfolds are as ubiquitous as folds.
And of course the whole Curry-Howard isomorphism is really about category theory and I’ve found that to be quite illuminating.
A nice readable account on fold/unfold is contained in here. There’s no shortage of tutorials on monads in computer science so I won’t bother with a link to one of those.