Distributive Laws are Monads

Early on we claimed, with no explanation, that distributive laws are monads. As the title of this post suggests, we are now in a place to explain the details of what this rather intriguing statement means. This will require our previous experience of monads in a 2-category, and distributive laws. In particular, the ability to define monads within arbitrary 2-categories gives us an awful lot of additional expressive freedom. Our first step will be to introduce a 2-category suitable for formalising relationships between monads.

A 2-category of Monads

The 2-category that we will be interested in has monads as 0-cells, Eilenberg-Moore laws as 1-cells, and compatible natural transformations as 2-cells. We now spell out the details.

For an arbitrary 2-category \mathbf{K}, there is a 2-category \mathbf{Mnd}(\mathbf{K}) with:

  1. 0-cells: Tuples (\mathcal{C}, \mathbb{T}, \eta, \mu) consisting of a 0-cell \mathcal{C}, such that (\mathbb{T},\eta,\mu) is a monad on \mathcal{C} in \mathbf{K}.
  2. 1-cells: A 2-cell (\mathcal{C}, \mathbb{S}, \eta^{\mathbb{S}}, \mu^{\mathbb{S}}) \rightarrow (\mathcal{D}, \mathbb{T}, \eta^{\mathbb{T}}, \mu^{\mathbb{T}}) is a pair (U,\varphi) consisting of a 1-cell U : \mathcal{C} \rightarrow \mathcal{D}, and a 2-cell \varphi : \mathbb{T} \circ U \Rightarrow U \circ \mathbb{S}, such that \varphi is an Eilenberg-Moore law.
  3. 2-cells: A 2-cell (U,\varphi) \Rightarrow (U',\varphi') is a 2-cell \sigma : U \Rightarrow U' such that \varphi' \cdot (\mathbb{T} \circ \sigma) = (\sigma \circ \mathbb{S}) \cdot \varphi.

Horizontal composition is given by

(V,\psi : \mathbb{T} \circ V \Rightarrow V \circ \mathbb{S}) \circ (U,\varphi : \mathbb{S} \circ U \Rightarrow U \circ \mathbb{R}) = (V \circ U, (V \circ \varphi) \cdot (\psi \circ V))


\mathsf{Id}_{(\mathcal{C},\mathbb{T},\eta,\mu)} = (\mathsf{Id}_{\mathcal{C}}, \mathsf{id}_{\mathbb{T}})

The vertical composition and identities for 2-cells in \mathbf{Mnd}(\mathbf{K}) are inherited from \mathbf{K}.

Monads in the 2-category of Monads

We now consider what a monad in \mathbf{Mnd}(\mathbf{K}) boils down to. As we will be working a 2-category constructed from another 2-category, and with 3 different monads, we will be fussy in spelling out the details carefully.

A monad in \mathbf{Mnd}(\mathbf{K}) consists of four pieces of data:

  1. A 0-cell in \mathbf{Mnd}(\mathbf{K}). That is, some monad (\mathcal{C}, \mathbb{S}, \eta^{\mathbb{S}}, \mu^{\mathsf{S}}) in \mathbf{K}.
  2. A 1-cell in \mathbf{Mnd}(\mathbf{K}) of type (\mathcal{C}, \mathbb{S}, \eta^{\mathbb{S}}, \mu^{\mathsf{S}}) \rightarrow (\mathcal{C}, \mathbb{S}, \eta^{\mathbb{S}}, \mu^{\mathsf{S}}). That is, a 1-cell \mathbb{T} : \mathcal{C} \rightarrow \mathcal{C} in \mathbf{K}, and an Eilenberg-Moore law \lambda : \mathbb{S} \circ \mathbb{T} \Rightarrow \mathbb{T} \circ \mathbb{S}.
  3. A unit 2-cell of type \mathsf{Id}_{(\mathcal{C}, \mathbb{S}, \eta^{\mathbb{S}}, \mu^{\mathsf{S}})} \Rightarrow (\mathbb{T}, \lambda) in \mathbf{Mnd}(\mathbf{K}). That is, a 2-cell \eta^{\mathbb{T}} : \mathsf{Id}_{\mathcal{C}} \Rightarrow \mathbb{T} in \mathbf{K} such that \lambda \cdot (\mathbb{S} \circ \eta^{\mathbb{T}}) = \eta^{\mathbb{T}} \circ \mathbb{S}.
  4. A multiplication 2-cell of type (\mathbb{T}, \lambda) \circ (\mathbb{T}, \lambda) \Rightarrow (\mathbb{T}, \lambda) in \mathbf{Mnd}(\mathbf{K}). That is, a 2-cell \mu^{\mathbb{T}} : \mathbb{T} \circ \mathbb{T} \Rightarrow \mathbb{T} in \mathbf{K} such that \lambda \cdot (\mathbf{S} \circ \mu^{\mathbb{T}}) = \mu^{\mathbb{T}} \cdot (\mathbb{T} \circ \lambda) \cdot (\lambda \circ \mathbb{T}).

The unit and associativity axioms for a monad in \mathbf{Mnd}(\mathbf{K}) are equivalent to requiring that (\mathbb{T}, \eta^{\mathbb{T}}, \mu^{\mathbb{T}}) satisfies those axioms for a monad on \mathcal{C} in \mathbf{K}. Finally, the two equations satisfied by the unit and multiplication as 2-cells in \mathbf{Mnd}(\mathbf{K}) are equivalent to requiring that \lambda is a Kleisli-law. As we noted previously, being a distributive law is equivalent to simultaneously being an Eilenberg-Moore law and a Kleisli law. Therefore, a monad in \mathbf{Mnd}(\mathbf{K}) is equivalent to the following data:

  1. A 0-cell \mathcal{C} in \mathbf{K}.
  2. A pair of monads (\mathbf{S}, \eta^{\mathbb{S}}, \mu^{\mathbb{S}}) and (\mathbb{T}, \eta^{\mathbb{T}}, \mu^{\mathbb{T}}) on \mathcal{C} in \mathbf{K}.
  3. A distributive law \mathbb{S} \circ \mathbb{T} \Rightarrow \mathbb{T} \circ \mathbb{S} in \mathbf{K}.

Roughly speaking, up to being more careful to specify all the required data, a distributive law in \mathbf{K} is the same thing as a monad in \mathsf{Mnd}(\mathbf{K}).

Example: For the “ordinary” monads discussed in the previous post, a distributive law is a monad in \mathbf{Mnd}(\mathbf{Cat}).

If we iterate the monad 2-category construction, a distributive law in \mathbf{K} is the same thing as a 0-cell in \mathbf{Mnd}(\mathbf{Mnd}(\mathbf{K})).


This relatively short post has unravelled an observation of Street, to show how a distributive law can be seen as a monad in a suitable 2-category. This both served as an illustration of the power of the notion of monad in a 2-category, and provided an excuse to introduce the 2-category \mathsf{Mnd}(\mathbf{K}). This 2-category is important more broadly in the theory of monads and distributive laws. In particular, by using the different dualities that apply in a 2-category, which we encountered when discussing comonads, we can incorporate comonads and Kleisli laws in the same setting. By iterating these constructions, we can consider different flavours of distributive laws such as monad-comonad or comonad-monad distributive laws. Hopefully we will get the chance to return to these topics later.

Further reading: The constructions outlined in this post were introduced in Street’s “Formal Theory of Monads”, along with vastly more important ideas than we have had chance to discuss. The 2-category \mathsf{Mnd}(\mathbf{K}) is also discussed in a very readable way, with more motivation for computer scientists, in Power and Watanabe’s “Combining a Monad and a Comonad”, along with many other interesting developments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: