Because of your inconsistent line-breaks!
Now we need to invent do-notation, higher kinds and typeclasses and this code would be well composable.
I can't wait until they release rich errors and this nonsense with reinventing checked exceptions will finally end.
Non trivial operations have errors when the happy path fails. And with web apps IO can fail anytime, anywhere for any reasons.
Sometimes you want to handle them locally, sometimes globally. The question is how ergonomic it is to handle this all for a variety of use cases.
We keep reinventing the wheel because we insist that our own use cases are “special” and “unique”, but they really aren’t.
Personally, I think Java’s proposal on catching errors in switches, next to ordinary data is the right step forward.
Monads are great. You can do lots of great things in them, but ergonomic they are not. We should avoid polluting our type systems where possible.