File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
src/Control/Monad/Class/MonadSTM Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 1
- name : Cheks
1
+ name : Checks
2
2
3
3
on :
4
4
pull_request :
Original file line number Diff line number Diff line change 2
2
3
3
## next release
4
4
5
+ ### Non breaking change
6
+
7
+ * Add ` writeTMVar ` to ` MonadSTM ` .
8
+
5
9
### Breaking changes
6
10
7
11
* ` MonadST ` depends on ` PrimMonad ` .
Original file line number Diff line number Diff line change
1
+ {-# LANGUAGE CPP #-}
1
2
{-# LANGUAGE DataKinds #-}
2
3
{-# LANGUAGE DefaultSignatures #-}
3
4
{-# LANGUAGE DerivingStrategies #-}
@@ -571,7 +572,11 @@ instance MonadSTM IO where
571
572
readTMVar = STM. readTMVar
572
573
tryReadTMVar = STM. tryReadTMVar
573
574
swapTMVar = STM. swapTMVar
575
+ #if MIN_VERSION_stm(2, 5, 1)
574
576
writeTMVar = STM. writeTMVar
577
+ #else
578
+ writeTMVar = writeTMVar'
579
+ #endif
575
580
isEmptyTMVar = STM. isEmptyTMVar
576
581
newTQueue = STM. newTQueue
577
582
readTQueue = STM. readTQueue
@@ -1245,3 +1250,10 @@ instance MonadSTM m => MonadSTM (ReaderT r m) where
1245
1250
1246
1251
(.:) :: (c -> d ) -> (a -> b -> c ) -> (a -> b -> d )
1247
1252
(f .: g) x y = f (g x y)
1253
+
1254
+ -- TODO: writeTMVar was introduced in stm-2.5.1. But io-sim supports stm older than that
1255
+ -- Therefore this can be removed once we don't need backwards compatibility with stm.
1256
+ #if !MIN_VERSION_stm(2,5,1)
1257
+ writeTMVar' :: STM. TMVar a -> a -> STM. STM ()
1258
+ writeTMVar' t new = STM. tryTakeTMVar t >> STM. putTMVar t new
1259
+ #endif
You can’t perform that action at this time.
0 commit comments