did #7 in haskell
did #8 in haskell