4 ms·
Came here to say that. I think do notation (and applicative idioms) are easily one of the most-underappreciated features outside the Haskell community.
by IngoBlechschmid 7y ago
Came here to say that. I think do notation (and applicative idioms) are easily one of the most-underappreciated features outside the Haskell community.
- yawaramin 7y agoScala has had monadic do-notation (called 'for-comprehensions') for a long time and OCaml has recently gained both monadic and applicative 'do notation' (called various things, but mostly 'let+ syntax'). Edit: Oh and F# has also had computation expressions for a long time.
- z1mm32m4n 7y agoIt’s even nicer in Haskell because not only does do-notation make code look clean, await is a function, not an operator. Want prefix await? Go for it! res <- await $ foo bar Want postfix? You can have that too! res <- foo bar & await Being “just a function” means it composes with everything else in the language, something the Rust languages designers have held in high regard when designing this. (But I also fully appreciate the design constraints that prevent Rust from using “just a method” or ”just a macro”)