|
1 | | -{-# OPTIONS_GHC -fno-warn-name-shadowing #-} |
2 | | -{-# LANGUAGE CPP, DeriveDataTypeable #-} |
| 1 | +{-# LANGUAGE CPP #-} |
| 2 | +{-# LANGUAGE DeriveDataTypeable #-} |
3 | 3 |
|
4 | 4 | #if __GLASGOW_HASKELL__ >= 701 |
5 | | -{-# LANGUAGE Trustworthy #-} |
| 5 | +{-# LANGUAGE Trustworthy #-} |
6 | 6 | #endif |
7 | 7 |
|
8 | 8 | ----------------------------------------------------------------------------- |
@@ -44,21 +44,21 @@ module Control.Concurrent.STM.TBQueue ( |
44 | 44 | isFullTBQueue, |
45 | 45 | ) where |
46 | 46 |
|
47 | | -import Data.Typeable |
48 | | -import Numeric.Natural |
49 | | -import GHC.Conc |
50 | | - |
51 | | -#define _UPK_(x) {-# UNPACK #-} !(x) |
| 47 | +import Data.Typeable (Typeable) |
| 48 | +import GHC.Conc (STM, TVar, newTVar, newTVarIO, orElse, |
| 49 | + readTVar, retry, writeTVar) |
| 50 | +import Numeric.Natural (Natural) |
| 51 | +import Prelude hiding (read) |
52 | 52 |
|
53 | 53 | -- | 'TBQueue' is an abstract type representing a bounded FIFO channel. |
54 | 54 | -- |
55 | 55 | -- @since 2.4 |
56 | 56 | data TBQueue a |
57 | | - = TBQueue _UPK_(TVar Natural) -- CR: read capacity |
58 | | - _UPK_(TVar [a]) -- R: elements waiting to be read |
59 | | - _UPK_(TVar Natural) -- CW: write capacity |
60 | | - _UPK_(TVar [a]) -- W: elements written (head is most recent) |
61 | | - _UPK_(Natural) -- CAP: initial capacity |
| 57 | + = TBQueue {-# UNPACK #-} !(TVar Natural) -- CR: read capacity |
| 58 | + {-# UNPACK #-} !(TVar [a]) -- R: elements waiting to be read |
| 59 | + {-# UNPACK #-} !(TVar Natural) -- CW: write capacity |
| 60 | + {-# UNPACK #-} !(TVar [a]) -- W: elements written (head is most recent) |
| 61 | + !(Natural) -- CAP: initial capacity |
62 | 62 | deriving Typeable |
63 | 63 |
|
64 | 64 | instance Eq (TBQueue a) where |
|
0 commit comments