Just as the notion of a monad in a bicategory generalizes that of a monoid in a monoidal category, modules over monoids generalize easily to modules over monads.
A special case of this (see below) is often called an algebra for a monad.
Let be a bicategory and a monad in with structure 2-cells and . Then a left -module is given by a 1-cell and a 2-cell , where
commute. Similarly, a right -module is given by a 1-cell and a 2-cell , with commuting diagrams as above with on the left instead of on the right.
Given monads on and on , an -bimodule is given by a 1-cell , together with the structures of a right -module and a left -module that are compatible in the sense that the diagram
commutes. Such a bimodule may be written as .
A morphism of left -modules is given by a 2-cell such that . Similarly, a morphism of right -modules is such that . A morphism of bimodules is given by that is a morphism of both left and right modules.
If and is a monad on a category , then a left -module , where is the terminal category, is usually called a -algebra: it is given by an object together with a morphism , such that
and
commute.
In particular, every algebra in this sense over a monad has the structure of an algebra over the underlying endofunctor .
-algebras can also be defined as left modules over qua monoid in . There the object is represented by the constant endofunctor at .
The Eilenberg-Moore category of is the category of these algebras. It has a universal property that allows the notion of Eilenberg–Moore object to be defined in any bicategory.
Given bimodules and , where are monads on respectively, we may be able to form the tensor product just as in the case of bimodules over rings. If the hom-categories of the bicategory have coequalizers that are preserved by composition on both sides, then the tensor product is given by the coequalizer in
where the parallel arrows are the two induced actions and on . It is straightforward, though a little tedious, to show that this is an -bimodule, the conditions following from those on together with the fact that coequalizers are epimorphisms and that (because of the condition on ) whiskering one coequalizer diagram on either side results in another.
If satisfies the above conditions then there is a bicategory consisting of monads, bimodules and bimodule morphisms in .
If , the bicategory of spans of sets, then a monad in is precisely a small category. Then , the category of small categories, profunctors and natural transformations.
More generally, , for any category with coequalizers and pullbacks that preserve them, consists of internal categories in , together with internal profunctors between them and transformations between those.