stm-chans 3.0.0.5 → 3.0.0.6
raw patch · 9 files changed
+59/−179 lines, 9 filessetup-changed
Files
- CHANGELOG +3/−0
- README.md +0/−13
- Setup.hs +1/−20
- src/Control/Concurrent/STM/TBChan.hs +9/−26
- src/Control/Concurrent/STM/TBMChan.hs +14/−31
- src/Control/Concurrent/STM/TBMQueue.hs +10/−27
- src/Control/Concurrent/STM/TMChan.hs +10/−27
- src/Control/Concurrent/STM/TMQueue.hs +6/−23
- stm-chans.cabal +6/−12
CHANGELOG view
@@ -1,3 +1,6 @@+3.0.0.6 (2021-10-17):+ - Removed old __HADDOCK__ hack+ - Updating stale emails, urls, etc 3.0.0.5 (2021-10-16): - Fixed the cabal file for Cabal >1.24 3.0.0.4 (2015-05-30):
README.md view
@@ -32,19 +32,6 @@ $> cabal install stm-chans -Or if you don't have cabal-install, then you can use the Cabal-library:-- $> runhaskell Setup.hs configure- $> runhaskell Setup.hs build- $> runhaskell Setup.hs test- $> runhaskell Setup.hs haddock --hyperlink-source- $> runhaskell Setup.hs copy- $> runhaskell Setup.hs register--The test step is optional and currently does nothing. The Haddock-step is also optional.- ## Links
Setup.hs view
@@ -1,26 +1,7 @@ #!/usr/bin/env runhaskell--- Cf. <http://www.mail-archive.com/haskell-cafe@haskell.org/msg59984.html>--- <http://www.haskell.org/pipermail/haskell-cafe/2008-December/051785.html> -{-# OPTIONS_GHC -Wall -fwarn-tabs -fno-warn-missing-signatures #-} module Main (main) where import Distribution.Simple-import Distribution.Simple.LocalBuildInfo (withPrograms)-import Distribution.Simple.Program (userSpecifyArgs)----------------------------------------------------------------- --- | Define __HADDOCK__ when building documentation. main :: IO ()-main = defaultMainWithHooks- $ simpleUserHooks `modify_haddockHook` \oldHH pkg lbi hooks flags -> do- -- Call the old haddockHook with a modified LocalBuildInfo- (\lbi' -> oldHH pkg lbi' hooks flags)- $ lbi `modify_withPrograms` \oldWP ->- userSpecifyArgs "haddock" ["--optghc=-D__HADDOCK__"] oldWP---modify_haddockHook hooks f = hooks { haddockHook = f (haddockHook hooks) }-modify_withPrograms lbi f = lbi { withPrograms = f (withPrograms lbi) }------------------------------------------------------------------------------------------------------------------------------ fin.+main = defaultMain
src/Control/Concurrent/STM/TBChan.hs view
@@ -1,28 +1,16 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} {-# LANGUAGE CPP, DeriveDataTypeable #-} --- HACK: in GHC 7.10, Haddock complains about Control.Monad.STM and--- System.IO.Unsafe being imported but unused. However, if we use--- CPP to avoid including them under Haddock, then it will fail to--- compile!-#ifdef __HADDOCK__-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-#endif- #if __GLASGOW_HASKELL__ >= 701-# ifdef __HADDOCK__-{-# LANGUAGE Trustworthy #-}-# else {-# LANGUAGE Safe #-}-# endif #endif ------------------------------------------------------------------- 2015.03.29+-- 2021.10.17 -- | -- Module : Control.Concurrent.STM.TBChan--- Copyright : Copyright (c) 2011--2015 wren gayle romano+-- Copyright : Copyright (c) 2011--2021 wren gayle romano -- License : BSD--- Maintainer : wren@community.haskell.org+-- Maintainer : wren@cpan.org -- Stability : provisional -- Portability : non-portable (GHC STM, DeriveDataTypeable) --@@ -61,12 +49,6 @@ import Control.Monad.STM (STM, retry) import Control.Concurrent.STM.TVar import Control.Concurrent.STM.TChan -- N.B., GHC only---- N.B., we need a Custom cabal build-type for this to work.-#ifdef __HADDOCK__-import Control.Monad.STM (atomically)-import System.IO.Unsafe (unsafePerformIO)-#endif ---------------------------------------------------------------- -- | @TBChan@ is an abstract type representing a bounded FIFO@@ -96,8 +78,9 @@ -- | @IO@ version of 'newTBChan'. This is useful for creating--- top-level @TBChan@s using 'unsafePerformIO', because using--- 'atomically' inside 'unsafePerformIO' isn't possible.+-- top-level @TBChan@s using 'System.IO.Unsafe.unsafePerformIO',+-- because using 'Control.Monad.STM.atomically' inside+-- 'System.IO.Unsafe.unsafePerformIO' isn't possible. newTBChanIO :: Int -> IO (TBChan a) newTBChanIO n = do slots <- newTVarIO n@@ -205,15 +188,15 @@ -- | Returns @True@ if the supplied @TBChan@ is empty (i.e., has--- no elements). /N.B./, a @TBChan@ can be both ``empty'' and--- ``full'' at the same time, if the initial limit was non-positive.+-- no elements). /N.B./, a @TBChan@ can be both \"empty\" and+-- \"full\" at the same time, if the initial limit was non-positive. isEmptyTBChan :: TBChan a -> STM Bool isEmptyTBChan (TBChan _slots _reads chan) = isEmptyTChan chan -- | Returns @True@ if the supplied @TBChan@ is full (i.e., is over--- its limit). /N.B./, a @TBChan@ can be both ``empty'' and ``full''+-- its limit). /N.B./, a @TBChan@ can be both \"empty\" and \"full\" -- at the same time, if the initial limit was non-positive. /N.B./, -- a @TBChan@ may still be full after reading, if 'unGetTBChan' was -- used to go over the initial limit.
src/Control/Concurrent/STM/TBMChan.hs view
@@ -1,28 +1,16 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} {-# LANGUAGE CPP, DeriveDataTypeable #-} --- HACK: in GHC 7.10, Haddock complains about Control.Monad.STM and--- System.IO.Unsafe being imported but unused. However, if we use--- CPP to avoid including them under Haddock, then it will fail to--- compile!-#ifdef __HADDOCK__-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-#endif- #if __GLASGOW_HASKELL__ >= 701-# ifdef __HADDOCK__-{-# LANGUAGE Trustworthy #-}-# else {-# LANGUAGE Safe #-}-# endif #endif ------------------------------------------------------------------- 2015.03.29+-- 2021.10.17 -- | -- Module : Control.Concurrent.STM.TBMChan--- Copyright : Copyright (c) 2011--2015 wren gayle romano+-- Copyright : Copyright (c) 2011--2021 wren gayle romano -- License : BSD--- Maintainer : wren@community.haskell.org+-- Maintainer : wren@cpan.org -- Stability : provisional -- Portability : non-portable (GHC STM, DeriveDataTypeable) --@@ -69,12 +57,6 @@ import Control.Monad.STM (STM, retry) import Control.Concurrent.STM.TVar import Control.Concurrent.STM.TChan -- N.B., GHC only---- N.B., we need a Custom cabal build-type for this to work.-#ifdef __HADDOCK__-import Control.Monad.STM (atomically)-import System.IO.Unsafe (unsafePerformIO)-#endif ---------------------------------------------------------------- -- | @TBMChan@ is an abstract type representing a bounded closeable@@ -107,8 +89,9 @@ -- | @IO@ version of 'newTBMChan'. This is useful for creating--- top-level @TBMChan@s using 'unsafePerformIO', because using--- 'atomically' inside 'unsafePerformIO' isn't possible.+-- top-level @TBMChan@s using 'System.IO.Unsafe.unsafePerformIO',+-- because using 'Control.Monad.STM.atomically' inside+-- 'System.IO.Unsafe.unsafePerformIO' isn't possible. newTBMChanIO :: Int -> IO (TBMChan a) newTBMChanIO n = do closed <- newTVarIO False@@ -136,7 +119,7 @@ x <- readTChan chan modifyTVar' reads (1 +) return (Just x)-{- +{- -- The above is slightly optimized over the clearer: readTBMChan (TBMChan closed _slots reads chan) = b <- readTVar closed@@ -173,7 +156,7 @@ Just _x -> do modifyTVar' reads (1 +) return (Just mx)-{- +{- -- The above is slightly optimized over the clearer: tryReadTBMChan (TBMChan closed _slots reads chan) = b <- readTVar closed@@ -208,7 +191,7 @@ peekTBMChan (TBMChan closed _slots _reads chan) = do b <- isEmptyTChan chan b' <- readTVar closed- if b && b' + if b && b' then return Nothing else Just <$> peekTChan chan -- TODO: compare Core and benchmarks; is the loss of clarity worth it?@@ -230,7 +213,7 @@ tryPeekTBMChan (TBMChan closed _slots _reads chan) = do b <- isEmptyTChan chan b' <- readTVar closed- if b && b' + if b && b' then return Nothing else Just <$> tryPeekTChan chan -- TODO: compare Core and benchmarks; is the loss of clarity worth it?@@ -310,16 +293,16 @@ -- | Returns @True@ if the supplied @TBMChan@ is empty (i.e., has--- no elements). /N.B./, a @TBMChan@ can be both ``empty'' and--- ``full'' at the same time, if the initial limit was non-positive.+-- no elements). /N.B./, a @TBMChan@ can be both \"empty\" and+-- \"full\" at the same time, if the initial limit was non-positive. isEmptyTBMChan :: TBMChan a -> STM Bool isEmptyTBMChan (TBMChan _closed _slots _reads chan) = isEmptyTChan chan -- | Returns @True@ if the supplied @TBMChan@ is full (i.e., is--- over its limit). /N.B./, a @TBMChan@ can be both ``empty'' and--- ``full'' at the same time, if the initial limit was non-positive.+-- over its limit). /N.B./, a @TBMChan@ can be both \"empty\" and+-- \"full\" at the same time, if the initial limit was non-positive. -- /N.B./, a @TBMChan@ may still be full after reading, if -- 'unGetTBMChan' was used to go over the initial limit. --
src/Control/Concurrent/STM/TBMQueue.hs view
@@ -1,28 +1,16 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} {-# LANGUAGE CPP, DeriveDataTypeable #-} --- HACK: in GHC 7.10, Haddock complains about Control.Monad.STM and--- System.IO.Unsafe being imported but unused. However, if we use--- CPP to avoid including them under Haddock, then it will fail to--- compile!-#ifdef __HADDOCK__-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-#endif- #if __GLASGOW_HASKELL__ >= 701-# ifdef __HADDOCK__-{-# LANGUAGE Trustworthy #-}-# else {-# LANGUAGE Safe #-}-# endif #endif ------------------------------------------------------------------- 2015.03.29+-- 2021.10.17 -- | -- Module : Control.Concurrent.STM.TBMQueue--- Copyright : Copyright (c) 2011--2015 wren gayle romano+-- Copyright : Copyright (c) 2011--2021 wren gayle romano -- License : BSD--- Maintainer : wren@community.haskell.org+-- Maintainer : wren@cpan.org -- Stability : provisional -- Portability : non-portable (GHC STM, DeriveDataTypeable) --@@ -67,12 +55,6 @@ import Control.Monad.STM (STM, retry) import Control.Concurrent.STM.TVar import Control.Concurrent.STM.TQueue -- N.B., GHC only---- N.B., we need a Custom cabal build-type for this to work.-#ifdef __HADDOCK__-import Control.Monad.STM (atomically)-import System.IO.Unsafe (unsafePerformIO)-#endif ---------------------------------------------------------------- -- | @TBMQueue@ is an abstract type representing a bounded closeable@@ -105,8 +87,9 @@ -- | @IO@ version of 'newTBMQueue'. This is useful for creating--- top-level @TBMQueue@s using 'unsafePerformIO', because using--- 'atomically' inside 'unsafePerformIO' isn't possible.+-- top-level @TBMQueue@s using 'System.IO.Unsafe.unsafePerformIO',+-- because using 'Control.Monad.STM.atomically' inside+-- 'System.IO.Unsafe.unsafePerformIO' isn't possible. newTBMQueueIO :: Int -> IO (TBMQueue a) newTBMQueueIO n = do closed <- newTVarIO False@@ -308,16 +291,16 @@ -- | Returns @True@ if the supplied @TBMQueue@ is empty (i.e., has--- no elements). /N.B./, a @TBMQueue@ can be both ``empty'' and--- ``full'' at the same time, if the initial limit was non-positive.+-- no elements). /N.B./, a @TBMQueue@ can be both \"empty\" and+-- \"full\" at the same time, if the initial limit was non-positive. isEmptyTBMQueue :: TBMQueue a -> STM Bool isEmptyTBMQueue (TBMQueue _closed _slots _reads queue) = isEmptyTQueue queue -- | Returns @True@ if the supplied @TBMQueue@ is full (i.e., is--- over its limit). /N.B./, a @TBMQueue@ can be both ``empty'' and--- ``full'' at the same time, if the initial limit was non-positive.+-- over its limit). /N.B./, a @TBMQueue@ can be both \"empty\" and+-- \"full\" at the same time, if the initial limit was non-positive. -- /N.B./, a @TBMQueue@ may still be full after reading, if -- 'unGetTBMQueue' was used to go over the initial limit. --
src/Control/Concurrent/STM/TMChan.hs view
@@ -1,28 +1,16 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} {-# LANGUAGE CPP, DeriveDataTypeable #-} --- HACK: in GHC 7.10, Haddock complains about Control.Monad.STM and--- System.IO.Unsafe being imported but unused. However, if we use--- CPP to avoid including them under Haddock, then it will fail to--- compile!-#ifdef __HADDOCK__-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-#endif- #if __GLASGOW_HASKELL__ >= 701-# ifdef __HADDOCK__-{-# LANGUAGE Trustworthy #-}-# else {-# LANGUAGE Safe #-}-# endif #endif ------------------------------------------------------------------- 2015.03.29+-- 2021.10.17 -- | -- Module : Control.Concurrent.STM.TMChan--- Copyright : Copyright (c) 2011--2015 wren gayle romano+-- Copyright : Copyright (c) 2011--2021 wren gayle romano -- License : BSD--- Maintainer : wren@community.haskell.org+-- Maintainer : wren@cpan.org -- Stability : provisional -- Portability : non-portable (GHC STM, DeriveDataTypeable) --@@ -63,12 +51,6 @@ import Control.Monad.STM (STM) import Control.Concurrent.STM.TVar import Control.Concurrent.STM.TChan -- N.B., GHC only---- N.B., we need a Custom cabal build-type for this to work.-#ifdef __HADDOCK__-import Control.Monad.STM (atomically)-import System.IO.Unsafe (unsafePerformIO)-#endif ---------------------------------------------------------------- -- | @TMChan@ is an abstract type representing a closeable FIFO@@ -88,15 +70,16 @@ -- | @IO@ version of 'newTMChan'. This is useful for creating--- top-level @TMChan@s using 'unsafePerformIO', because using--- 'atomically' inside 'unsafePerformIO' isn't possible.+-- top-level @TMChan@s using 'System.IO.Unsafe.unsafePerformIO',+-- because using 'Control.Monad.STM.atomically' inside+-- 'System.IO.Unsafe.unsafePerformIO' isn't possible. newTMChanIO :: IO (TMChan a) newTMChanIO = do closed <- newTVarIO False chan <- newTChanIO return (TMChan closed chan)- + -- | Like 'newBroadcastTChan'. -- -- /Since: 2.1.0/@@ -105,8 +88,8 @@ closed <- newTVar False chan <- newBroadcastTChan return (TMChan closed chan)- + -- | @IO@ version of 'newBroadcastTMChan'. -- -- /Since: 2.1.0/@@ -188,7 +171,7 @@ peekTMChan (TMChan closed chan) = do b <- isEmptyTChan chan b' <- readTVar closed- if b && b' + if b && b' then return Nothing else Just <$> peekTChan chan -- TODO: compare Core and benchmarks; is the loss of clarity worth it?@@ -210,7 +193,7 @@ tryPeekTMChan (TMChan closed chan) = do b <- isEmptyTChan chan b' <- readTVar closed- if b && b' + if b && b' then return Nothing else Just <$> tryPeekTChan chan -- TODO: compare Core and benchmarks; is the loss of clarity worth it?
src/Control/Concurrent/STM/TMQueue.hs view
@@ -1,28 +1,16 @@ {-# OPTIONS_GHC -Wall -fwarn-tabs #-} {-# LANGUAGE CPP, DeriveDataTypeable #-} --- HACK: in GHC 7.10, Haddock complains about Control.Monad.STM and--- System.IO.Unsafe being imported but unused. However, if we use--- CPP to avoid including them under Haddock, then it will fail to--- compile!-#ifdef __HADDOCK__-{-# OPTIONS_GHC -fno-warn-unused-imports #-}-#endif- #if __GLASGOW_HASKELL__ >= 701-# ifdef __HADDOCK__-{-# LANGUAGE Trustworthy #-}-# else {-# LANGUAGE Safe #-}-# endif #endif ------------------------------------------------------------------- 2015.03.29+-- 2021.10.17 -- | -- Module : Control.Concurrent.STM.TMQueue--- Copyright : Copyright (c) 2011--2015 wren gayle romano+-- Copyright : Copyright (c) 2011--2021 wren gayle romano -- License : BSD--- Maintainer : wren@community.haskell.org+-- Maintainer : wren@cpan.org -- Stability : provisional -- Portability : non-portable (GHC STM, DeriveDataTypeable) --@@ -62,12 +50,6 @@ import Control.Monad.STM (STM) import Control.Concurrent.STM.TVar import Control.Concurrent.STM.TQueue -- N.B., GHC only---- N.B., we need a Custom cabal build-type for this to work.-#ifdef __HADDOCK__-import Control.Monad.STM (atomically)-import System.IO.Unsafe (unsafePerformIO)-#endif ---------------------------------------------------------------- -- | @TMQueue@ is an abstract type representing a closeable FIFO@@ -87,8 +69,9 @@ -- | @IO@ version of 'newTMQueue'. This is useful for creating--- top-level @TMQueue@s using 'unsafePerformIO', because using--- 'atomically' inside 'unsafePerformIO' isn't possible.+-- top-level @TMQueue@s using 'System.IO.Unsafe.unsafePerformIO',+-- because using 'Control.Monad.STM.atomically' inside+-- 'System.IO.Unsafe.unsafePerformIO' isn't possible. newTMQueueIO :: IO (TMQueue a) newTMQueueIO = do closed <- newTVarIO False
stm-chans.cabal view
@@ -1,19 +1,19 @@ ------------------------------------------------------------------- wren gayle romano <wren@community.haskell.org> ~ 2021.10.16+-- wren gayle romano <wren@cpan.org> ~ 2021.10.17 ---------------------------------------------------------------- -- Cabal >=1.10 is required by Hackage. Cabal-Version: >= 1.10--- We need a custom build in order to define __HADDOCK__-Build-Type: Custom+Build-Type: Simple Name: stm-chans-Version: 3.0.0.5+Version: 3.0.0.6 Stability: provisional-Homepage: http://wrengr.org+Homepage: https://wrengr.org/software/hackage.html+Bug-Reports: https://github.com/wrengr/stm-chans/issues Author: wren gayle romano, Thomas DuBuisson Maintainer: wren@cpan.org-Copyright: Copyright (c) 2011--2021 wren gayle romano+Copyright: Copyright (c) 2011–2021 wren gayle romano License: BSD3 License-File: LICENSE @@ -41,12 +41,6 @@ Location: https://github.com/wrengr/stm-chans.git ------------------------------------------------------------------- HACK: since Cabal-1.24 we need this stansa to explicitly loosen--- the upper bound on the Cabal library used for Setup.hs.--- TODO: Just about makes me want to abandon our __HADDOCK__ hack.-Custom-Setup- Setup-Depends: base >= 4.1 && < 5- , Cabal >= 1.14 && < 3.5 Library Default-Language: Haskell2010 -- N.B., the following versions are required for: