by Bruce Pascoe - 1 May, 2019
"A monad is just a monoid in the category of endofunctors. What's the problem?" ~James Iry[^1]
The problem... is that there are several problems.
It's been said that monads bear a dreadful curse. Once you finally understand what they are, you begin to see them everywhere--but somehow become completely incapable of explaining them to anyone else. Many tutorial writers have tried to break the Great Curse--the Web is lousy with bold attempts and half successes that attest to this--and just as many have failed. Well, I'm here to address the elephant in the room[^2] and tell you that I intend to break the Great Curse once and for all.
There are basically two ways a monad tutorial tends to go. One is a paragraph or two of minimal descriptions of one or two common monads (Haskell's Maybe
in particular is very popular), followed by a lot of intimidating Haskell syntax trying to explain--precisely--how it all fits together. This is well