It saddens me that modern languages have basically implemented their own "monadic" syntax for specific cases without implementing something more generic. Rust, Kotlin, and Swift have `?` for the Option/Error monad, Javascript, C#, Python, and Rust all have `await` for the Promise monad. Both of these things and way more are possible with `<-` in Haskell, and while `do` notation isn't perfect, I'd really like another language that tried to build on that instead of doing ad-hoc syntax for the common cases.
Now that I'm on the side of "I know what a monad is", let me just say 95% of what people say monads are is complete trash and unhelpful. This includes calling them "semicolons".<p>I don't think this analogy sets up anyone for success. For a long time now I've wanted to do a series on "FP for OOP folks".
Monads are not "Programmable Semicolons". I understand the thinking behind the statement but it really does a disservice to people who doesn't know Monads using those kind of analogies.
I remember elsewhere on HN I got totally shat on for this analogy. The main case where this doesn’t apply is that monads can decide <i>whether or not to execute later computations</i> and that’s why it’s actually more general than a programmable semicolon. I think the programmable semicolon is more applicable to applicative functors than monads.
Why limit yourself to programmable semicolons? I hear C++ is going to have <i>programmable whitespace</i>: <a href="http://www.stroustrup.com/whitespace98.pdf" rel="nofollow">http://www.stroustrup.com/whitespace98.pdf</a>