Assignment 2 (Haskell) Solution