[Haskell-cafe] How to simplify this code?