P24: Tweaked Haskell solution.