[Haskell-cafe] atomicModifyMutVar and casMutVar

Thomas Bereknyei tomberek at gmail.com
Wed Apr 25 15:38:48 CEST 2012

I have seen some push to take advantage of the new primop casMutVar, yet I
see that atomicModifyMutVar hasn't been used yet either. For example,
modifySTRef is just a read followed by a write. I've been unable to create
a version that does not allocate with something as simple as modifySTRef
ref (+1).

There is a package Data.Ref.Unboxed that allows ST to use an unboxed
STURef, but even though I can see the Core using Int#, any use of
modifySTURef, or any version I've been able to make will excessively
box/rebox.  Should I instead be using something like modifySTURef ref
(GHC.Prim.+#) or can this be automatically done by the compiler?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120425/5336e4e3/attachment.htm>

More information about the Haskell-Cafe mailing list