summaryrefslogtreecommitdiff
path: root/compiler/utils/IOEnv.hs
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-01-27 16:20:54 -0800
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-01-28 13:54:58 -0800
commit07ee96faac4996cde0ab82789eec0b70d1a35af0 (patch)
tree1a36efc948d7634a95734d0c527286a5070f4c76 /compiler/utils/IOEnv.hs
parent276da7929c187f007c198a38e88bdad91866e500 (diff)
downloadhaskell-07ee96faac4996cde0ab82789eec0b70d1a35af0.tar.gz
Use strict atomicModifyIORef' (added in GHC 7.6).
Summary: Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: austin, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D635
Diffstat (limited to 'compiler/utils/IOEnv.hs')
-rw-r--r--compiler/utils/IOEnv.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/utils/IOEnv.hs b/compiler/utils/IOEnv.hs
index 46f6e467c1..fd98bad213 100644
--- a/compiler/utils/IOEnv.hs
+++ b/compiler/utils/IOEnv.hs
@@ -38,7 +38,7 @@ import Module
import Panic
import Data.IORef ( IORef, newIORef, readIORef, writeIORef, modifyIORef,
- atomicModifyIORef )
+ atomicModifyIORef, atomicModifyIORef' )
import Data.Typeable
import System.IO.Unsafe ( unsafeInterleaveIO )
import System.IO ( fixIO )
@@ -194,10 +194,7 @@ atomicUpdMutVar var upd = liftIO (atomicModifyIORef var upd)
-- | Strict variant of 'atomicUpdMutVar'.
atomicUpdMutVar' :: IORef a -> (a -> (a, b)) -> IOEnv env b
-atomicUpdMutVar' var upd = do
- r <- atomicUpdMutVar var upd
- _ <- liftIO . evaluate =<< readMutVar var
- return r
+atomicUpdMutVar' var upd = liftIO (atomicModifyIORef' var upd)
----------------------------------------------------------------------
-- Accessing the environment