stm-chans 1.3.0 → 1.3.1
raw patch · 5 files changed
+21/−28 lines, 5 filesdep ~stmPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: stm
API changes (from Hackage documentation)
Files
- VERSION +2/−0
- src/Control/Concurrent/STM/TChan/Compat.hs +6/−9
- src/Control/Concurrent/STM/TMVar/Compat.hs +6/−8
- src/Control/Concurrent/STM/TVar/Compat.hs +5/−9
- stm-chans.cabal +2/−2
VERSION view
@@ -1,3 +1,5 @@+1.3.1 (2012-02-29):+ - Corrected the CPP macros now that stm-2.3 is released. 1.3.0 (2012-02-25): - Added Control.Concurrent.STM.TMVar.Compat 1.2.0.3 (2012-02-12):
src/Control/Concurrent/STM/TChan/Compat.hs view
@@ -1,7 +1,7 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} {-# LANGUAGE CPP #-} ------------------------------------------------------------------- 2011.04.03+-- 2012.02.29 -- | -- Module : Control.Concurrent.STM.TChan.Compat -- Copyright : Copyright (c) 2011--2012 wren ng thornton@@ -12,7 +12,7 @@ -- -- Compatibility layer for older versions of the @stm@ library. -- Namely, we define 'tryReadTChan', 'peekTChan', and 'tryPeekTChan'--- which @stm-X.X.X@ lacks. These implementations are less efficient+-- which @stm<2.3.0@ lacks. These implementations are less efficient -- than the package versions due to the 'TChan' type being abstract. -- However, this module uses Cabal-style CPP macros in order to use -- the package versions when available.@@ -39,10 +39,7 @@ import Control.Concurrent.STM.TChan -- N.B., GHC only --- BUG: What version will these really be added?--- <http://hackage.haskell.org/trac/ghc/ticket/5104>--- <http://www.haskell.org/pipermail/cvs-libraries/2011-April/012914.html>-#if ! (MIN_VERSION_stm(9,0,0))+#if ! (MIN_VERSION_stm(2,3,0)) import Control.Applicative ((<$>)) import Control.Monad.STM (STM) @@ -54,7 +51,7 @@ tryReadTChan chan = do b <- isEmptyTChan chan if b then return Nothing else Just <$> readTChan chan-{- -- Optimized implementation for when patching @stm@+{- -- The optimized implementation in stm-2.3.0 tryReadTChan (TChan read _write) = do hd <- readTVar =<< readTVar read case hd of@@ -72,7 +69,7 @@ x <- readTChan chan unGetTChan chan x return x-{- -- Optimized implementation for when patching @stm@+{- -- The optimized implementation in stm-2.3.0 peekTChan (TChan read _write) = do hd <- readTVar =<< readTVar read case hd of@@ -87,7 +84,7 @@ tryPeekTChan chan = do b <- isEmptyTChan chan if b then return Nothing else Just <$> peekTChan chan-{- -- Optimized implementation for when patching @stm@+{- -- The optimized implementation in stm-2.3.0 tryPeekTChan (TChan read _write) = do hd <- readTVar =<< readTVar read case hd of
src/Control/Concurrent/STM/TMVar/Compat.hs view
@@ -1,7 +1,7 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} {-# LANGUAGE CPP #-} ------------------------------------------------------------------- 2012.02.25+-- 2012.02.29 -- | -- Module : Control.Concurrent.STM.TMVar.Compat -- Copyright : Copyright (c) 2011--2012 wren ng thornton@@ -11,7 +11,7 @@ -- Portability : non-portable (STM, CPP) -- -- Compatibility layer for older versions of the @stm@ library.--- Namely, we define 'tryReadTMVar' which @stm-X.X.X@ lacks. This+-- Namely, we define 'tryReadTMVar' which @stm<2.3.0@ lacks. This -- module uses Cabal-style CPP macros in order to use the package -- versions when available. This isn't actually used by the @stm-chans@ -- package, but we provide it anyways since we provide compatibility@@ -44,21 +44,19 @@ import Control.Concurrent.STM.TMVar --- BUG: What version will these really be added?--- <http://hackage.haskell.org/trac/ghc/ticket/5104>--- <http://www.haskell.org/pipermail/cvs-libraries/2011-April/012914.html>-#if ! (MIN_VERSION_stm(9,0,0))+#if ! (MIN_VERSION_stm(2,3,0)) import Control.Concurrent.STM (STM) ---------------------------------------------------------------- --- | A version of 'readTMVar' which does not retry. Instead it returns @Nothing@ if no value is available.+-- | A version of 'readTMVar' which does not retry. Instead it+-- returns @Nothing@ if no value is available. tryReadTMVar :: TMVar a -> STM (Maybe a) tryReadTMVar var = do m <- tryTakeTMVar var case m of Nothing -> return Nothing Just x -> putTMVar var x >> return (Just x)-{- -- The optimized implementation in the patch to @stm@+{- -- The optimized implementation in stm-2.3.0 tryReadTMVar (TMVar t) = readTVar t {-# INLINE tryReadTMVar #-} -}
src/Control/Concurrent/STM/TVar/Compat.hs view
@@ -1,7 +1,7 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} {-# LANGUAGE CPP #-} ------------------------------------------------------------------- 2011.04.03+-- 2012.02.29 -- | -- Module : Control.Concurrent.STM.TVar.Compat -- Copyright : Copyright (c) 2011--2012 wren ng thornton@@ -11,8 +11,8 @@ -- Portability : non-portable (STM, CPP) -- -- Compatibility layer for older versions of the @stm@ library.--- Namely, we define 'readTVarIO' which @stm-2.1.1@ lacks; and we--- define 'modifyTVar', 'modifyTVar'', and 'swapTVar' which @stm-X.X.X@+-- Namely, we define 'readTVarIO' which @stm<2.1.2@ lacks; and we+-- define 'modifyTVar', 'modifyTVar'', and 'swapTVar' which @stm<2.3.0@ -- lacks. This module uses Cabal-style CPP macros in order to use -- the package versions when available. ----------------------------------------------------------------@@ -41,10 +41,7 @@ import Control.Concurrent.STM (atomically) #endif --- BUG: What version will these really be added?--- <http://hackage.haskell.org/trac/ghc/ticket/5104>--- <http://www.haskell.org/pipermail/cvs-libraries/2011-April/012914.html>-#if ! (MIN_VERSION_stm(9,0,0))+#if ! (MIN_VERSION_stm(2,3,0)) import Control.Concurrent.STM (STM) #endif ----------------------------------------------------------------@@ -63,8 +60,7 @@ #endif --- BUG: What version will these really be added?-#if ! (MIN_VERSION_stm(9,0,0))+#if ! (MIN_VERSION_stm(2,3,0)) -- Like 'modifyIORef' but for @TVar@. -- | Mutate the contents of a @TVar@. /N.B./, this version is
stm-chans.cabal view
@@ -9,7 +9,7 @@ Build-Type: Custom Name: stm-chans-Version: 1.3.0+Version: 1.3.1 Stability: provisional Homepage: http://code.haskell.org/~wren/ Author: wren ng thornton, Thomas DuBuisson@@ -35,7 +35,7 @@ -- Not sure what the real minbounds are for base and stm... -- -- N.B., stm >= 2.1.2 is required for fast readTVarIO. And- -- stm >= ?.?.? is required for fast tryReadTChan, peekTChan,+ -- stm >= 2.3.0 is required for fast tryReadTChan, peekTChan, -- tryPeekTChan, tryReadTMVar, modifyTVar, modifyTVar', swapTVar. Build-Depends: base >= 4.1 && < 5 , stm >= 2.1.1