In category theory, a branch of mathematics, a monad is a triple ( T , η , μ ) {\displaystyle (T,\eta ,\mu )} consisting of a functor T from a category to itself and two natural transformations η , μ {\displaystyle \eta ,\mu } that satisfy versions of the associativity and unitality axioms. Equivalently, a monad is a monoid in the category of endofunctors of some fixed category (an endofunctor is a functor mapping a category to itself). For example, if F , G {\displaystyle F,G} are functors adjoint to each other, then T = G ∘ F {\displaystyle T=G\circ F} together with η , μ {\displaystyle \eta ,\mu } determined by the adjoint relation is a monad. According to mathematician John Baez, a monad can be considered at least in two ways:
A monad as a generalized monoid; this is clear since a monad is a monoid in a certain category, A monad as a tool for studying algebraic gadgets; for example, a group can be described by a certain monad. Monads are used in the theory of pairs of adjoint functors, and they generalize closure operators on partially ordered sets to arbitrary categories. Monads are also useful in the theory of datatypes, the denotational semantics of imperative programming languages, and in functional programming languages, allowing languages without mutable state to do things such as simulate for-loops; see Monad (functional programming). A monad is also called, especially in old literature, a triple, triad, standard construction and fundamental construction.
Introduction and definition A monad is a certain type of endofunctor. For example, if F {\displaystyle F} and G {\displaystyle G} are a pair of adjoint functors, with F {\displaystyle F} left adjoint to G {\displaystyle G} , then the composition G ∘ F {\displaystyle G\circ F} is a monad. If F {\displaystyle F} and G {\displaystyle G} are inverse to each other, the corresponding monad is the identity functor. In general, adjunctions are not equivalences—they relate categories of different natures. The monad theory matters as part of the effort to capture what it is that adjunctions 'preserve'. The other half of the theory, of what can be learned likewise from consideration of F ∘ G {\displaystyle F\circ G} , is discussed under the dual theory of comonads.
Formal definition Throughout this article, C {\displaystyle C} denotes a category. A monad on C {\displaystyle C} consists of an endofunctor T : C → C {\displaystyle T\colon C\to C} together with two natural transformations: η : 1 C → T {\displaystyle \eta \colon 1_{C}\to T} (where 1 C {\displaystyle 1_{C}} denotes the identity functor on C {\displaystyle C} ) and μ : T 2 → T {\displaystyle \mu \colon T^{2}\to T} (where T 2 {\displaystyle T^{2}} is the functor T ∘ T {\displaystyle T\circ T} from C {\displaystyle C} to C {\displaystyle C} ). These are required to fulfill the following conditions (sometimes called coherence conditions):
μ ∘ T μ = μ ∘ μ T {\displaystyle \mu \circ T\mu =\mu \circ \mu T} (as natural transformations T 3 → T {\displaystyle T^{3}\to T} ); here T μ {\displaystyle T\mu } and μ T {\displaystyle \mu T} are formed by "horizontal composition".
μ ∘ T η = μ ∘ η T = 1 T {\displaystyle \mu \circ T\eta =\mu \circ \eta T=1_{T}} (as natural transformations T → T {\displaystyle T\to T} ; here 1 T {\displaystyle 1_{T}} denotes the identity transformation from T {\displaystyle T} to T {\displaystyle T} ). We can rewrite these conditions using the following commutative diagrams:
See the article on natural transformations for the explanation of the notations T μ {\displaystyle T\mu } and μ T {\displaystyle \mu T} , or see below the commutative diagrams not using these notions:
… excerpt ends here. Continue reading the full article.






