Atomic compare and swap for IORefs and STRefs.
|:: IORef a|
|-> IO (Bool, a)|
A drop-in replacement for
optimistically attempts to compute the new value and CAS it into
place without introducing new thunks or locking anything. Note
that this is more STRICT than its standard counterpart and will only
place evaluated (WHNF) values in the IORef.
A simpler version that modifies the state but does not return anything.