Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Either monad is a very nice solution for this in my opinion, in Haskell it's just

  do bar
     baz
     bazz
with it immediately returning after the first error value it encounters or returning the actual result (this is also how Rust solves it, though they introduce specific syntactic sugar for it rather than an universal monadic sugar).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: