haskell solution