A monad is an endofunctor $T:C\rightarrow C$ with natural transformations $\eta:id_C\rightarrow T$ and $\mu:T^2\rightarrow T$.

Being natural transformations mean that $$T(f)\circ \eta_A = \eta_B\circ id_C(f)$$ should hold and $$T(f)\circ\mu_A = \mu_B\circ T^2(f)$$ also. These are the algebraic expressions that the defining diagrams of natural transformations commute.

Translating this to the language of functional programming, $\eta$ is unit, and a polymorphic one, so $\eta_{nat}$ is the monomorphisation of unit to the nat type. $\mu$ is join in the same sense. The functor $T$ consists of two things: it takes object and morphisms. The latter part is called map in functional programming. So the above equations translate to

map f o unit = unit o f

where, if f is A -> B then this is

map f o unit(A) = unit(B) o f

but that is usually handled with a polymorphic type system and the second equation is

map f o join = join o map (map f)

So, map is the morphism-translating part of the endofunctor $T$.

But what is the object-translating part of $T$ in functional programming? Is it the type operator M when we write unit: 'a -> 'a M ?

  • 1
    $\begingroup$ Yes, the action on objects of a monad M is precisely M itself, mapping A to M A. $\endgroup$
    – varkor
    Sep 14, 2023 at 18:42

1 Answer 1


Objects are isomorphic to identity morphisms. So, the object-translating portion of the endofunctor is a subportion of the morphism-translating portion, also carried by map.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.