What is a Monad?

In this post, we provide the minimal category theory background that is required to define a monad.

Definition of a Category

A category contains the following:

  1. Objects: A sequence of objects, denoted by :
  2. Arrows: A sequence of arrows denoted by

The above satisfy the following properties:

  1. For each arrow , there exist objects and called the domain and codomain of , respectively. We write to indicate and .
  2. For any two arrows and , there is an arrow called the composite of and .
  3. For each object , there exist the identity arrow
  4. Associativity:
  5. Unit: for every arrow

Functor

A homomorphism of categories is called a functor. More precisely, we call between two categories and , a functor iff:

  1. Arrow preservation:
  2. Identity preservation: for every
  3. Composition preservation:

That is, preserves domains and codomains, identity arrows, and composition.

Natural transformations

Let functors .

A natural transformation from to is an assignment to every object of a morphism in such that for every morphism in we have:

in

Monad

If is a category, a monad on is defined as an endfunctor equipped with two natural transformations:

The above natural transformations must satisfy: (a) and (b)

References

  1. Category Theory by Steve Adowey
Written on March 20, 2016