added haskell solution