Feeds:
Posts

## A monad is just a monoid in the category of endofunctors, what’s the problem?

Okay, but what’s the point of looking at monoids in the category of endofunctors?

Recall that if $m$ is a monoid in a monoidal category $(M, \otimes)$, then we can talk about a module over $m$: it’s an object $c$ equipped with an action map

$\displaystyle m \otimes c \to c$

satisfying some axioms. But this is clearly not the most general notion of action of a monoid we can think of. For example, we know what it means for an ordinary monoid $m$, in $\text{Set}$, to act on the objects of any category $C$ whatsoever (we just want a monoid homomorphism $m \to \text{End}(C)$), and that notion of monoid action isn’t subsumed by this definition.

Here’s something more general that comes closer. It’s not necessary that $m$ and $c$ live in the same category. Instead, $m$ can live in a monoidal category $(M, \otimes)$ while $c$ lives in a category $C$ equipped with the structure of a module category over $M$. In particular this means that there is an action functor

$\displaystyle \otimes : M \times C \to C$

with some extra structure satisfying some axioms. This allows us to make sense of $m \otimes c$ as an object in $C$ and hence to make sense of an action map $m \otimes c \to c$ as before, and even to state the usual axioms. (Another instance of the microcosm principle.)

Now, fix $C$. What is the most general monoidal category over which $C$ is a module category? Of course, it’s the monoidal category $\text{End}(C)$ of endofunctors of $C$. Hence the most general kind of monoid that can act on an object in $C$ is a monoid in $\text{End}(C)$, or equivalently a monad.

In fact, since an action of a monoidal category $M$ on $C$ can be described as a monoidal functor $M \to \text{End}(C)$, any action of a monoid $m \in M$ on an object $c \in C$ in the sense described above naturally factors through an action of a monad.

Example. Any cocomplete category $C$ is naturally a module category over $(\text{Set}, \times)$ with the action given by

$\displaystyle \text{Set} \times C \ni (X, c) \mapsto X \otimes c \cong \coprod_X c \in C$.

More precisely, in this situation we say that $C$ is tensored over $\text{Set}$ (which is in some sense dual to being enriched over $\text{Set}$). This lets us describe what it means for a monoid in $\text{Set}$ to act on an object $c \in C$.

Example. Any symmetric monoidal cocomplete category $C$ (this includes the hypothesis that the monoidal operation distributes over colimits) is naturally a module category over the monoidal category $\widehat{S}$ (see this blog post) of species (equipped with the composition product $\circ$) with the action given by

$\displaystyle \widehat{S} \times C \ni (F, c) \mapsto \coprod_{n \ge 0} F(n) \otimes_{S_n} c^{\otimes n}$

where $F(n) \otimes c^{\otimes n}$ denotes, as above, $\coprod_{F(n)} c^{\otimes n}$, and $\otimes_{S_n}$ denotes the quotient of this by the diagonal action of $S_n$.

This lets us describe what it means for a monoid in $(\widehat{S}, \circ)$ to act on an object $c \in C$. And a monoid in $(\widehat{S}, \circ)$ is precisely an operad.

### 4 Responses

1. […] also common to think of monads as generalized monoids; previously we discussed why this was a reasonable thing to […]

2. Do you know Haskell, Qiaochu?

• Unfortunately, no. I want to learn it but it’s just never a high enough priority.

• Ah, that’s a shame. I figured I could ask you about the category-theoretic interpretations of a lot of things people do in advanced Haskell, if you did.