News for hackers. Stuff that matters.
Re:Monads are like burritos (2009) by jerf on Sunday June 02, 2024 @06:22PM (#40557594)
"Monads embody the concept of "chaining" functions."

No, it doesn't. Monad implementations may call the provided function zero times, or multiple times. Chaining implies exactly once, one of the common misconceptions about the monad interface.

Flatmap is another common attractive nuisance; flatmap is the monad implementation for lists but is not "monad" in general, any more than "an iterator on linked lists" is "iterator" in general.

Re:Monads are like burritos (2009) by chuckadams on Sunday June 02, 2024 @08:17PM (#40558194)
Chaining implies sticking one function to another, with the implication that some data is being threaded through them. Whatever extra semantics go on top of that are gravy, it's a vague term for a vague concept. I even gave examples where the function might be invoked zero times (Maybe) or multiple times (List). And in some languages (I specifically mention one) flatmap is a function on all monads, not just lists.
Re:Monads are like burritos (2009) by jerf on Monday June 03, 2024 @09:46AM (#40562589)
If you understand it correctly, then use correct terms to describe it. And I don't mean the mathematically correct pristine words that some particular FP language uses, I mean, terms that will create correct impressions in the audience and not incorrect ones. You don't help by using the most commonly misunderstood terms and reinforcing the widespread misconceptions about how it works. Both "flatmap" and "chaining" create completely wrong impressions. You just leave people having to clear out the misunderstandings to get to the real and not really that complicated truth.
Re:Monads are like burritos (2009) by chuckadams on Monday June 03, 2024 @10:55AM (#40563227)
Feel free to jump in with your corrections or suggestions for the actual material then instead of sniping at my terminology. I'm done.