[Haskell] Pearls of Functional Algorithm Design question