C++ Ranges are Pure Monadic Goodness
We have this friendly competition going on between Eric Niebler and myself. He writes some clever C++ template code, and I feel the compulsion to explain it to him in functional terms. Then I write a...
View ArticleCategory Theory for Programmers: The Preface
For some time now I’ve been floating the idea of writing a book about category theory that would be targeted at programmers. Mind you, not computer scientists but programmers — engineers rather than...
View ArticleFormula 1: Go Functional!
I was recently visiting the Ferrari museum in Maranello, Italy, where I saw this display of telemetry data from racing cars. The processing and the display of telemetry data is an interesting...
View ArticleCategories Great and Small
In the previous installment of Category Theory for Programmers we talked about the category of types and functions. If you’re new to the series, here’s the Table of Contents. You can get real...
View ArticleKleisli Categories
In the previous installment of Categories for Programmers, Categories Great and Small, I gave a few examples of simple categories. In this installment we’ll work through a more advanced example. If...
View ArticleProducts and Coproducts
Categories for Programmers. In the previous installment we discussed how to add logging to pure functions. See the Table of Contents. Follow the Arrows The Ancient Greek playwright Euripides once said:...
View ArticleSimple Algebraic Data Types
Categories for Programmers. Previously Products and Coproducts. See the Table of Contents. We’ve seen two basic ways of combining types: using a product and a coproduct. It turns out that a lot of data...
View ArticleFunctors
This is part of Categories for Programmers. Previously: Simple Algebraic Data Types. See the Table of Contents. At the risk of sounding like a broken record, I will say this about functors: A functor...
View ArticleFunctoriality
This is part 8 of Categories for Programmers. Previously: Functors. See the Table of Contents. Now that you know what a functor is, and have seen a few examples, let’s see how we can build larger...
View ArticleFunction Types
This is part 9 of Categories for Programmers. Previously: Functoriality. See the Table of Contents. So far I’ve been glossing over the meaning of function types. A function type is different from other...
View ArticleNatural Transformations
This is part 10 of Categories for Programmers. Previously: Function Types. See the Table of Contents. We talked about functors as mappings between categories that preserve their structure. A functor...
View ArticleUsing Monads in C++ to Solve Constraints: 1. The List Monad
I am sometimes asked by C++ programmers to give an example of a problem that can’t be solved without monads. This is the wrong kind of question — it’s like asking if there is a problem that can’t be...
View ArticleFrom Lenses to Yoneda Embedding
Lenses are a fascinating subject. Edward Kmett’s lens library is an indispensable tool in every Haskell programmer’s toolbox. I set out to write this blog post with the goal of describing some new...
View ArticleFree Monoids
This is part 12 of Categories for Programmers. Previously: Limits and Colimits. See the Table of Contents. Monoids are an important concept in both category theory and in programming. Categories...
View ArticleThe Yoneda Lemma
This is part 15 of Categories for Programmers. Previously: Representable Functors. See the Table of Contents. Most constructions in category theory are generalizations of results from other more...
View ArticleOperads, Type Level Nats, and Tic-Tac-Toe
This summer I spent some time talking with Edward Kmett about lots of things. (Which really means that he was talking and I was trying to keep up.) One of the topics was operads. The ideas behind...
View ArticleYoneda Embedding
This is part 16 of Categories for Programmers. Previously: The Yoneda Lemma. See the Table of Contents. We’ve seen previously that, when we fix an object a in the category C, the mapping C(a, _) is a...
View ArticleIt’s All About Morphisms
This is part 17 of Categories for Programmers. Previously: Yoneda Embedding. See the Table of Contents. If I haven’t convinced you yet that category theory is all about morphisms then I haven’t done my...
View ArticleTambara Modules
I came in contact with Tambara modules when working on a categorical understanding of lenses. They were first mentioned to me by Edward Kmett, who implemented their Haskell version,...
View ArticleAdjunctions
This is part 18 of Categories for Programmers. Previously: It’s All About Morphisms. See the Table of Contents. In mathematics we have various ways of saying that one thing is like another. The...
View Article