Why monads?

Before looking at monads in any detail at all, it is worth considering why they might be an interesting subject to know about. In this post I will allow myself to mention a lot of complicated mathematical structures as illustrations. Many of these may be unfamiliar, depending on your background. We shall return to ground level in the next post.

Monads are lots of things

Monads can be considered from many different points of view. Depending on your perspective, a monad is:

  • A monoid in the category of endofunctors.
  • A categorification of a closure operator.
  • A (strict) 2-functor with domain the monoidal category of finite ordinals.
  • A (lax) 2-functor with domain the terminal bicategory.
  • A single object category enriched in a bicategory.
  • A functional programming abstraction for computational effects.
  • A presentation independent formulation of an algebraic theory.
  • A mapping of objects to term objects, with coherent insertion of generators and composition of families of terms.
  • A mapping of objects to term objects, with coherent insertion of generators and extension operations.

Although much of the terminology is probably baffling at this point, the key point is that this variety gives us many ways to start attacking a problem. The different viewpoints also suggest alternative ways in which the notion of monad can be generalized. For example, there are graded monads, indexed monads, pseudo-monads, relative monads to name but a few.

Lots of things are monads

For any mathematical abstraction to be useful, there should be plenty of examples. A surprisingly wide range of structures can be seen as monads:

  • Many “container like” structures, such as lists, sets, multisets and trees form monads.
  • Closure operators in order theory and topology are monads.
  • Free object constructions for algebraic theories form monads.
  • Preorders and categories themselves are monads.
  • Enriched and internal categories are monads.
  • Distributive laws for monads are themselves monads.
  • Monoids.

Monads come with useful things

Part of the richness of monad theory is that a monad comes with several associated mathematical structures:

  • A category of algebras, the Eilenberg-Moore category of the monad.
  • A category of free algebras, the Kleisli category of the monad.
  • Adjunctions between the base category and the Kleisli and Eilenberg-Moore categories.
  • A functor identifying the Kleisli category within the Eilenberg-Moore category.

Much of the richness of monad theory is derived from the interplay between the monad and these related mathematical structures. Although some of the terminology may currently be mysterious, we shall look at these constructions in detail in later posts.

Apart from the mathematical structures associated with a monad, there is also a large body of accompanying theory. Instantiating this theory appropriately can allow use to deduce lots of nice mathematical properties in many situations, whilst alleviating the need for lots of lower level manual work checking the details directly.

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: