File tree Expand file tree Collapse file tree 5 files changed +17
-0
lines changed Expand file tree Collapse file tree 5 files changed +17
-0
lines changed Original file line number Diff line number Diff 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
138140tryReadTChan :: TChan a -> STM (Maybe a )
139141tryReadTChan (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
150154peekTChan :: TChan a -> STM a
151155peekTChan (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
160166tryPeekTChan :: TChan a -> STM (Maybe a )
161167tryPeekTChan (TChan read _write) = do
162168 listhead <- readTVar read
Original file line number Diff line number Diff 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
138140tryReadTMVar :: TMVar a -> STM (Maybe a )
139141tryReadTMVar (TMVar t) = readTVar t
140142
Original file line number Diff line number Diff 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
4951modifyTVar :: TVar a -> (a -> a ) -> STM ()
5052modifyTVar 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
5761modifyTVar' :: TVar a -> (a -> a ) -> STM ()
5862modifyTVar' 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
6672swapTVar :: TVar a -> a -> STM a
6773swapTVar var new = do
6874 old <- readTVar var
Original file line number Diff line number Diff line change @@ -124,6 +124,7 @@ data STMret a = STMret (State# RealWorld) a
124124liftSTM :: STM a -> State # RealWorld -> STMret a
125125liftSTM (STM m) = \ s -> case m s of (# s', r # ) -> STMret s' r
126126
127+ -- | @since 2.3
127128instance MonadFix STM where
128129 mfix k = STM $ \ s ->
129130 let ans = liftSTM (k r) s
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ atomically (STM m) = do
5151 rollback <- readIORef r
5252 rollback
5353
54+ -- | @since 2.2.0
5455throwSTM :: Exception e => e -> STM a
5556throwSTM = STM . const . throwIO
5657
@@ -83,6 +84,7 @@ newTVarIO a = do
8384readTVar :: TVar a -> STM a
8485readTVar (TVar ref) = STM (const (readIORef ref))
8586
87+ -- | @since 2.1.2
8688readTVarIO :: TVar a -> IO a
8789readTVarIO (TVar ref) = readIORef ref
8890
You can’t perform that action at this time.
0 commit comments