a simple Haskell program & how I refactored it