More Haskell exercises (problem 28b from 99 haskell problems)