[Haskell-cafe] Beginner: IORef constructor?

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


Donald:
> 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!

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

Thanks for the link.

Udo:
> 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 ;)

Donald:
> 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 :)

TJ


More information about the Haskell-Cafe mailing list