Hacker News new | ask | show | jobs
by shirogane86x 1546 days ago
I still think that it would look a lot less bad than JS callback hell, mostly because of syntax.

  actA >>= \a -> 
  actB a >>= \b -> 
  pure doSomethingWith b
is a lot better (to my eyes) than:

  actA(a => 
    actB(a, b => 
      doSomethingWith(b)
    )
  )
      
and it gets worse from there (blocks to have statements to declare variables, or to call multiple functions. pre ES6 those would've also been functions rather than lambdas. Admittedly monad transformers aren't that great, but that's mostly because of the nxm amount of instances (to avoid explicit lifting).
1 comments

Yes, that's true, the infix bind and general Haskell syntax helps with the readability of the chained function calls.