diff options
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/GHC/Conc/Sync.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libraries/base/GHC/Conc/Sync.hs b/libraries/base/GHC/Conc/Sync.hs index 99df92daed..dbc81e1848 100644 --- a/libraries/base/GHC/Conc/Sync.hs +++ b/libraries/base/GHC/Conc/Sync.hs @@ -667,6 +667,14 @@ instance Monad STM where m >>= k = bindSTM m k (>>) = (*>) +-- | @since 4.17.0.0 +instance Semigroup a => Semigroup (STM a) where + (<>) = liftA2 (<>) + +-- | @since 4.17.0.0 +instance Monoid a => Monoid (STM a) where + mempty = pure mempty + bindSTM :: STM a -> (a -> STM b) -> STM b bindSTM (STM m) k = STM ( \s -> case m s of |