[Haskell-cafe] Beginner: IORef constructor?

TJ tjay.dreaming at gmail.com
Fri Dec 1 10:33:03 EST 2006

> This doesn't mean what you think it means :) In particular,
> theGlobalVariable isn't a global variable, its a function that creates a
> new IORef, initialised to []. So you create two new iorefs, once in
> modify1, and again in modify2.

Indeed, it's not what I thought it was at all!

> you may be interested in looking at
> http://haskell.org/haskellwiki/IO_inside

Thanks for the link.

> Whatever you're trying to do right now, just forget that there are
> variables in BASIC and do it without mutable state.

Alrighty. But I'd like to set the record straight that it was C++
which screwed up my mind forever ;)

> Note that there's no need for any mutable variables here. If this isn't
> suitable, perhaps you could elaborate a bit on what effect you're trying
> to achieve?

Yes I've come to the same conclusion. Thanks for the help, it really helps :)


More information about the Haskell-Cafe mailing list