[Haskell] "global variables" and code optimization