worked through chapter 5 of real world haskell