Adding problem 6 (Haskell)