An exercise in composing functions with nested types in Scala.