Examples of Monads
  1. For any category C an identity monad can be defined. It consists of an identity functor and identity morphisms.
  2. Suppose we have a group G. Let's define a monad MG in Set. The monad functor will be like this:
    X X × G.
    u(X) : X → X × G maps an element x to a pair (x,e), where e is the group's unit.
    MG(MG(X)) = (idX,mG), where mG is the group multiplication.
  3. Lists in Set. For a set X the result of applying the functor, let's call it List, is the set of all lists, (x1,x2,x3...), including the empty one, of elements of X. This functor becomes a popular monad if we add u and m. Let uX : X → List(X) create a single-element list for each xX. And mX: List(List(X)) → List(X) maps lists of lists to plain lists by flattening them