4 ms·
A PSA for those who explain monads: I've read several monad tutorials and read countless comments describing their uses, and I have not understood their advant
by jakevoytko 16y ago
A PSA for those who explain monads:
I've read several monad tutorials and read countless comments describing their uses, and I have not understood their advantages until reading this article. I'll fess up to my part of the problem: I never wrote any after reading these tutorials, but I wouldn't have known what to try. I knew they are an abstraction for computation (what isn't?), and they let you do things like safe division and LINQ, and they're like a burrito (what isn't?), but I could never look at code and say, "Obviously this needs a monad!" Demonstrating how monads introduce context, after showing what you mean by context and why it's useful, is a very helpful approach. Pronouns were a nice analogy. I don't fully grok monads yet, but now I'll look at code and decide that it might be nicer if I introduce a context