Member-only story
So, You Want To Understand Monads?
An intuitive explanation of an unnecessarily perplexing functional programming concept
I was just reading an article in which a poor soul was trying really hard to explain to the reader what a monad is and failing miserably because he himself did not truly understand it. Out of mostly a desire to help him, I thought it might make sense to write an article that allows people to understand the intuition behind monads first without going into crazy functional language syntax.
Whether or not I have succeeded in doing this is for you to judge, but let us jump right in.
I first encountered monads when they were introduced by Eugenio Moggi as a way to structure the semantics of programming languages. The formulation was elegant and clearly gave a nice mathematical shape to a very large class of programming language constructs that, until then, were only dealt with in isolation.
What Moggi brought forth in that paper (if you can abide the mathematics) was a depth of understanding of computation that only comes by once in a generation. Yes, it is a deeply intuitive paper that maps computer science intuition to solid mathematical foundations. I’m going to leave much of the mathematics out of the exposition here, but I do hope to impart the intuition.