by tromp · 5y ago · 0 comments
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!"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.