[Haskell-cafe] How can I refactor this code?