ref-fd 0.4.0.2 → 0.5
raw patch · 2 files changed
+21/−3 lines, 2 files
Files
- Control/Monad/Ref.hs +14/−0
- ref-fd.cabal +7/−3
Control/Monad/Ref.hs view
@@ -198,6 +198,20 @@ atomicModifyRef' = atomicModifyIORef' #endif /* MIN_VERSION_base(4,6,0) */ +-- Since there's no forking, it's automatically atomic.+instance MonadAtomicRef (STRef s) (ST s) where+ atomicModifyRef r f = do+ x <- readRef r+ let (x', y) = f x+ writeRef r x'+ return y++ atomicModifyRef' r f = do+ x <- readRef r+ let (x', y) = f x+ writeRef r $! x'+ return y+ instance MonadAtomicRef TVar STM where atomicModifyRef r f = do x <- readRef r let (x', y) = f x
ref-fd.cabal view
@@ -1,6 +1,6 @@ name: ref-fd-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@@ -15,11 +15,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