[Haskell-beginners] Global variables
es at ertes.de
Thu Jun 30 07:35:08 CEST 2011
Michael Snoyman <michael at snoyman.com> wrote:
> 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.
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.
nightmare = unsafePerformIO (getWrongWife >>= sex)
More information about the Beginners