Solve 4 in haskell