Notes from Chapter 12 of Programming in Scala, First Edition