Skip to content

Commit 5ea70d4

Browse files
committed
Add more @since annotations
1 parent b2adee4 commit 5ea70d4

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

Control/Concurrent/STM/TChan.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ readTChan (TChan read _write) = do
135135

136136
-- | A version of 'readTChan' which does not retry. Instead it
137137
-- returns @Nothing@ if no value is available.
138+
--
139+
-- @since 2.3
138140
tryReadTChan :: TChan a -> STM (Maybe a)
139141
tryReadTChan (TChan read _write) = do
140142
listhead <- readTVar read
@@ -147,6 +149,8 @@ tryReadTChan (TChan read _write) = do
147149

148150
-- | Get the next value from the @TChan@ without removing it,
149151
-- retrying if the channel is empty.
152+
--
153+
-- @since 2.3
150154
peekTChan :: TChan a -> STM a
151155
peekTChan (TChan read _write) = do
152156
listhead <- readTVar read
@@ -157,6 +161,8 @@ peekTChan (TChan read _write) = do
157161

158162
-- | A version of 'peekTChan' which does not retry. Instead it
159163
-- returns @Nothing@ if no value is available.
164+
--
165+
-- @since 2.3
160166
tryPeekTChan :: TChan a -> STM (Maybe a)
161167
tryPeekTChan (TChan read _write) = do
162168
listhead <- readTVar read

Control/Concurrent/STM/TMVar.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ readTMVar (TMVar t) = do
135135

136136
-- | A version of 'readTMVar' which does not retry. Instead it
137137
-- returns @Nothing@ if no value is available.
138+
--
139+
-- @since 2.3
138140
tryReadTMVar :: TMVar a -> STM (Maybe a)
139141
tryReadTMVar (TMVar t) = readTVar t
140142

Control/Concurrent/STM/TVar.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ import Control.Sequential.STM
4646
-- Like 'modifyIORef' but for 'TVar'.
4747
-- | Mutate the contents of a 'TVar'. /N.B./, this version is
4848
-- non-strict.
49+
--
50+
-- @since 2.3
4951
modifyTVar :: TVar a -> (a -> a) -> STM ()
5052
modifyTVar var f = do
5153
x <- readTVar var
@@ -54,6 +56,8 @@ modifyTVar var f = do
5456

5557

5658
-- | Strict version of 'modifyTVar'.
59+
--
60+
-- @since 2.3
5761
modifyTVar' :: TVar a -> (a -> a) -> STM ()
5862
modifyTVar' var f = do
5963
x <- readTVar var
@@ -63,6 +67,8 @@ modifyTVar' var f = do
6367

6468
-- Like 'swapTMVar' but for 'TVar'.
6569
-- | Swap the contents of a 'TVar' for a new value.
70+
--
71+
-- @since 2.3
6672
swapTVar :: TVar a -> a -> STM a
6773
swapTVar var new = do
6874
old <- readTVar var

Control/Monad/STM.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ data STMret a = STMret (State# RealWorld) a
124124
liftSTM :: STM a -> State# RealWorld -> STMret a
125125
liftSTM (STM m) = \s -> case m s of (# s', r #) -> STMret s' r
126126

127+
-- | @since 2.3
127128
instance MonadFix STM where
128129
mfix k = STM $ \s ->
129130
let ans = liftSTM (k r) s

Control/Sequential/STM.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ atomically (STM m) = do
5151
rollback <- readIORef r
5252
rollback
5353

54+
-- | @since 2.2.0
5455
throwSTM :: Exception e => e -> STM a
5556
throwSTM = STM . const . throwIO
5657

@@ -83,6 +84,7 @@ newTVarIO a = do
8384
readTVar :: TVar a -> STM a
8485
readTVar (TVar ref) = STM (const (readIORef ref))
8586

87+
-- | @since 2.1.2
8688
readTVarIO :: TVar a -> IO a
8789
readTVarIO (TVar ref) = readIORef ref
8890

0 commit comments

Comments
 (0)