ref-tf 0.4.0.2 → 0.5
raw patch · 2 files changed
+20/−3 lines, 2 files
Files
- Control/Monad/Ref.hs +13/−0
- ref-tf.cabal +7/−3
Control/Monad/Ref.hs view
@@ -225,6 +225,19 @@ atomicModifyRef' = atomicModifyIORef' #endif /* MIN_VERSION_base(4,6,0) */ +-- Since there's no forking, it's automatically atomic.+instance MonadAtomicRef (ST s) where+ atomicModifyRef r f = do+ v <- readRef r+ let (a, b) = f v+ writeRef r a+ return b+ atomicModifyRef' r f = do+ v <- readRef r+ let (a, b) = f v+ writeRef r $! a+ return b+ instance MonadAtomicRef STM where atomicModifyRef r f = do x <- readRef r let (x', y) = f x
ref-tf.cabal view
@@ -1,6 +1,6 @@ name: ref-tf-version: 0.4.0.2-cabal-version: >= 1.6+version: 0.5+cabal-version: >= 1.10 license: BSD3 license-file: LICENSE copyright: (c) 2006-2011 Harvard University@@ -14,11 +14,15 @@ description: Contains a 'MonadRef' type class that abstracts over the details of manipulating references, allowing one to write code that can operate in either the ST monad or the IO monad.-tested-with: GHC==7.4.2, GHC==7.6.3, GHC==7.8.3, GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.1+tested-with: GHC==7.4.2, GHC==7.6.3, GHC==7.8.3, GHC==7.10.3, GHC==8.0.2,+ GHC==8.2.2, GHC==8.4.3, GHC==8.6.5, GHC==8.8.4, GHC==8.10.4,+ GHC==9.0.1 build-type: Simple library+ default-language: Haskell2010+ exposed-modules: Control.Monad.Ref