solved prob 46 haskell