
17 May
2007
17 May
'07
1:46 p.m.
On 17/05/07, Eric
H|i,
Does anyone know of a simple and straightforward way to use global variables in Haskell?
You can pass around an environment with the State or Reader monads (read/write and read-only respectively). If you want to do IO with the data you'll probably need the transformer equivalents: StateT or ReaderT. I think there are some hackish ways of making IO variables but I don't know how that's done. I'd imagine it's frowned on from a stylistic point of view, too... D.