solve 6 in haskell