4 ms·
> Haskell uses the seriously complex machinery of monads to do I/O, supposedly without side effects (I don’t accept this). Seems like the author doesn't unders
by vmchale 5y ago
> Haskell uses the seriously complex machinery of monads to do I/O, supposedly without side effects (I don’t accept this).
Seems like the author doesn't understand what's going on.
- tromp 5y ago> And you end up writing stuff like main = do { putStrLn "Hello, World!" ; return () } which to me looks like C. There must be a more functional approach. It looks imperative because that's what Haskell's do-notation was designed to. But it's merely syntactic sugar for the functional equivalent main = putStrLn "Hello, World!" >> return () which btw is equivalent to simply main = putStrLn "Hello, World!"
- Choc13 5y agoYes! I've written about this from an F# perspective, which calls them 'computation expressions' instead of 'do notation', here https://dev.to/choc13/grokking-monads-imperatively-394a https://dev.to/choc13/grokking-monads-imperatively-394a If the author really doesn't like the "imperative" syntactic sugar then it's always possible to write equivalent code without it, but it quickly becomes painful for more complex situations. 'do notation' is just a more generalised version of what async/await does. No one wants to go back to writing async code with callbacks / continuations.
- dang 5y ago"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something." He's a well-known language designer, famous for his work in dataflow, whose work was influential in the field. We should ask him to explain what he meant by that, before jumping to internet cheap shots. https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html