atomicModifyMutVar and casMutVar

25 Apr
2012
25 Apr
'12
9:38 a.m.
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?
4774
Age (days ago)
4774
Last active (days ago)
0 comments
1 participants
participants (1)
-
Thomas Bereknyei