Haskell: Solved problem 7