What is a monad?
A monad is a triple (T, η, μ)
where
T
is an endofunctorT: X -> X
andη: I -> T
andμ: T x T -> T
are 2 natural transformations satisfying these laws:- Identity law:
μ(η(T)) = T = μ(T(η))
- Associative law:
μ(μ(T × T) × T)) = μ(T × μ(T × T))
- Identity law:
In other words:
a monad in X is just a monoid in the category of endofunctors of X, with