Problem 55 in Haskell