News for hackers. Stuff that matters.
Re:JavaScript in 2015 by zak_mc_kracken on Wednesday January 07, 2015 @12:48PM (#8851937)
It's mostly easier to read because it no longer deals with error cases. All code becomes easier to read if you ignore errors.

I can make my code arbitrarily short if it doesn't have to be correct.

Re:JavaScript in 2015 by chrisdotcode on Wednesday January 07, 2015 @01:17PM (#8852169)
That's the magic of monads: the errors are all handled for you (in an encapsulated, lossless way), and you can deal with them (if you choose) at the end of the chain, just the same as promises (because promises are a monad).
Re:JavaScript in 2015 by zak_mc_kracken on Wednesday January 07, 2015 @01:38PM (#8852316)
The same can be said of exceptions.

However, my comment above had nothing to do with how you handle errors, it was about the unsoundness of comparing code that handles errors to code that doesn't.

Re:JavaScript in 2015 by chrisdotcode on Wednesday January 07, 2015 @01:50PM (#8852412)
Right - What I'm saying is that the above former code does handle the error, in the exact same way as the latter code.

For clarification, the error is handled implicitly (but you'd know what kind of error it was due to the type signature), but you can always handle it in manner you choose to at any point.

Re:JavaScript in 2015 by tel on Wednesday January 07, 2015 @02:15PM (#8852601)
It's not really the same as exceptions in a typed language because it's forced to be delimited. Even in Javascript you'll have to do a little ceremony to "escape" the golden path driven by the monad, though you'll have many ways to take short-cuts and forget details.