We introduced monads on a category as a triple consisting of an endofunctor and unit and multiplication natural transformations:

The unit and multiplication are required to satisfy three axioms (which specify that they form a monoid in a suitably abstract sense). There is actually quite a bit of work implied in establishing we have a monad this way. We have to verify that:

- Our construction is a well-defined endofunctor on the base category.
- Our candidate unit is a legitimate natural transformation.
- Our candidate multiplication is a legitimate natural transformation.
- The unitality and associativity axioms hold.

This actually can be quite fiddly to do in practice. For example, verifying the associativity axiom requires working with objects of the form . If our endofunctor is complicated, this can lead to cumbersome calculations, and scope for errors.

## An Alternative Formulation

A **monad in extension form** (sometimes also referred to as **Kleisli form**) on a category is a triple consisting of:

- An operation on objects .
- An -indexed family of
**unit**morphisms . - An
**extension**operation on morphisms .

These must satisfy three axioms:

- .
- .
- .

Although they might seem less natural from the point of view of category theory, these axioms can be significantly easier to verify in practice.

If we refer to our previous definition of monad as a **monad in monoid form**, we can convert freely between the two at our convenience.

Given a monad in monoid form , we can produce a monad in Kleisli form as follows:

- The mapping is the object mapping of the functor.
- The unit components are those of .
- The extension mapping is .

In the other direction, given a monad in extension form , we construct a monad in monoid form as follows:

- We extend to an endofunctor by defining the action on morphisms as .
- The components of the unit are the .
- The component of the multiplication at is .

Verifying that the required properties hold in each direction, and the these mappings are mutually inverse, is a routine if long-winded exercise. We shall omit the details.

The key new feature is the extension operation. As usual, it is interesting to consider what an operation is doing from the point of view of algebra. Consider a monad with equational presentation . Recall the elements of are equivalence classes of -terms, quotiented by provable equality in equational logic. As we have observed before, a function

can be identified with an -indexed family of equivalence classes of term, which we shall denote:

The action of is defined on representatives of equivalence classes as follows:

So the Kleisli extension is a substitution operation on representatives of equivalence classes.

## Different Perspectives

Aside from the possible practical benefits in terms of easier verification, there are other reasons to prefer one form over another:

- The monad in monoid form formulation is entirely in terms of categories, functors and natural transformations. We can therefore easily generalize this definition to any other bicategory. Categories become 0-cells, functors 1-cells and natural transformations 2-cells. This is an extremely fruitful direction of generalization. For example, it immediately yields a definition of monad suitable for enriched category theory.
- The monad in extension form formulation emphasizes different aspects. There is a generalization of monads called relative monads, in which we move beyond endofunctors. The required definition takes as its starting point the extension formulation.

We shall talk about various generalizations of monads in later posts, once we have more basics under our belts.

## 2 thoughts on “What’s a monad (take two)?”