
30 Jun
2011
30 Jun
'11
1:35 a.m.
Michael Snoyman
Though in this case, you can go with the cheaper IORef, since (presumably) the only operation is going to be incrementing the counter. Just be sure to use atomicModifyIORef[1].
I never recommend (or mention for that matter) IORefs in the beginner list. Also I think than an atomically modified IORef is not necessarily faster. TVars are optimized for that kind of operation. Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/