code for second blog post - monads-in-scala-2