first two haskell solutions