Haskell problem 9