Dmitry thank you for your post.
Arturo
1

There is another FP way to handle “something wrong” without losing information about reason why you have no value —Either monad.

It allows us to incorporate a context of possible failure to our values while also being able to attach values to the failure, so that they can describe what went wrong or provide some other useful info regarding the failure.
Structure is pretty simple: value can either be a Right value, signifying the right answer and a success, or it can be a Left value, signifying failure.

Either monad implementation in Haskell

It’s not that simple as Maybe, but still hot.

I don’t think that purely functional code would have an issue with multiple exception types, but if there is such situation — alright, pattern matching handling is quite OK.

As for me, it’s even simpler than Java7+ way :)

Show your support

Clapping shows how much you appreciated Dmytro Zhluktenko’s story.