To be fair, the fact that JavaScript needs a custom syntax (requiring preprocessing) for a problem this specific is upsetting. By contrast, the Haskell solution has just uses the IO monad - effectful-computations returning something of type `a` become first class and have type `IO a`. If you want to get dicey about atomic operations you have the `STM` monad. If you want to make very clear when you sequence versus race operations (and more along those lines) you have the `Async` monad. None of these need a special syntax - they are just regular monads.
That said, I agree that the article should at least mention the likes of `await`...
Comments
To be fair, the fact that JavaScript needs a custom syntax (requiring preprocessing) for a problem this specific is upsetting. By contrast, the Haskell solution has just uses the IO monad - effectful-computations returning something of type `a` become first class and have type `IO a`. If you want to get dicey about atomic operations you have the `STM` monad. If you want to make very clear when you sequence versus race operations (and more along those lines) you have the `Async` monad. None of these need a special syntax - they are just regular monads.
That said, I agree that the article should at least mention the likes of `await`...
"To be fair" Haskell has so many syntactic and compiler extensions that it's a genuine problem for code maintenance over time.
Begrudging Javascript 1 or 2 seems somewhat petty given how common it is to see compiler extension preambles at the top of every haskell module.
Point taken, but this is more a reflection of the fact _GHC_ is used as a playground for every new PL idea.
Haskell itself has no extensions, and you certainly don't need any extension to get what I was talking about above.