Optional type and monads
We all need to write some validation code from time to time. Usually this logic is implemented using if-else statements. Suppose our method expects Document entity as an argument and if customerId is not set, we should throw an exception. Sounds simple at first, but what if our…