Solve 9 in haskell