Exercises from my functional programming in scala chapter 4 "Handling errors without exceptions"