Added bits from Chapter 19 of Programming in Scala.