We previously looked at a generalization of the familiar algebraic concept of a monoid to a category. We’re now in a position to give the “mathematician’s definition” of a monad. People seem to have different opinions of this definition. I personally think that it’s simple, elegant, and captures the spirit of generality of category theory. I have heard that some people use this definition to belittle or confuse people. Perhaps it’s just that people feel belittled or confused by it. In any case, describing a monad isn’t easy, and we shouldn’t feel bad if we don’t understand it very well at first.
At the risk of alienating those of you who are more interested in software than abstract mathematics, I’d like to write about some basic category theory. The idea is to work my way up to defining a monad, because that seems to be a requisite exercise for any programming language blogger. Here, I’d like to talk about something a bit simpler: monoids.