Global variables?
Tom Pledger
Tom.Pledger@peace.com
Tue, 4 Feb 2003 08:08:24 +1300
Richard Uhtenwoldt writes:
:
| The solution I prefer replaces that last with
|
| >main=do
| > globalVar<-newIORef 0
| > let
| > foo = fff aaa bbb ccc
| > bar = ggg xxx yyy zzz
| > mmm >> nnn >> ooo
:
| Am I the only one who prefers the above "lexical scope" solution
| to all the solutions in Hughes's paper and given previously on
| this list?
No, I prefer it too. It would be even nicer with parameterised
modules, so that we could do something like
main = do
globalVar <- newIORef 0
let import (EvenBulkierThanFooAndBar globalVar)
foo = fff aaa bbb ccc
bar = ggg xxx yyy zzz
mmm >> nnn >> ooo
instead of passing globalVar to several of EvenBulkierThanFooAndBar's
exported functions separately.
- Tom