By now, we’ve seen the simple algebraic monoid, which is essentially an
abstract construction of a category. We’ve also seen the more complicated, but interesting monoidal category – which is, sort of, a meta-category – a category built using categories. The monoidal category is a fairly complicated object – but it’s useful.
What does a algebraic monoid look like in category theory? The categorical monoid is a complex object – a monoid built from monoids. If we render the algebraic monoid in terms of a basic category, what do we get? A monoid is, basically, a category with one object. That’s it: every algebraic monoid is a single object category.
But we can do something more interesting than that. We know what a monoidal category looks like. What if we take a monoidal category, and express the fundamental concept of a monoid in it?
The result is the categorical monoid, also known as a categorical monoid object. It’s really very simple. Take a monoidal category. If you recall, in a monoidal category, we’ve got a “tensor” operation, ⊗;
a categorical notion of identity, defined using a special object called
Unit (written “I” or “1”) and two morphisms λ (left identity) and ρ (right identity); and a categorical notion of associativity defined using a morphism α.
To construct a categorical monoid object, all that we do is take the
basic definitions of an algebraic monoid, and use them to draw a category
diagram.
So, if we have a monoidal category C, then a monoid in the category is
an object M, with two morphisms μ and η. The arrow μ is the
representation of multiplication: it’s an arrow μ:M⊗M→M.
η is a morphism called unit which represents identity; it is a
morphism from the monoidal category’s identity object to M; η:I→M.
The triple (M,μ,η) is a monoid if and only if the following two
diagrams commute:
With this construction, a monoid object in the category of sets is
exactly an algebraic monoid. So we’ve come full circle – we’ve gone
from the algebraic monoid, to the monoidal category, to the categorical monoid, back to the algebraic monoid.
Back when I started to down this categorical path, I said that it helped to understand some of the more complex ideas in abstract algebra. Here’s one example. Take the category of abelian groups. A monoid within the
category of abelian groups is a ring. The rings second operation, and its properties are precisely the set of properties that are implied by the commuting diagram above. And as you’ll see in later posts, we can use that to understand more about rings in terms of categorical definitions and diagrams.
So take the category of endofunctors on $C$ — functors from $C$ to itself and natural transformations between them. Now we can compose these functors, making this a monoidal category. What’s a monoid object in this category?
Be sure to link back to your Haskell coverage.