[Haskell-cafe] How to make such code?