did #2 in haskell