Safe approach to CAS and other atomic ops in Haskell
