Skip to content
Snippets Groups Projects
Commit a642471c authored by Jens Nolte's avatar Jens Nolte
Browse files

Fix catchSTM'; add catchAllSTM'


Co-authored-by: default avatarJan Beinke <git@janbeinke.com>
parent 2b384f9f
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,7 @@ module Control.Concurrent.STM.Class ( ...@@ -39,6 +39,7 @@ module Control.Concurrent.STM.Class (
throwSTM, throwSTM,
catchSTM, catchSTM,
catchSTM', catchSTM',
catchAllSTM',
-- * Unique -- * Unique
...@@ -262,10 +263,14 @@ catchSTM :: (MonadSTM m, Exception e) => STM a -> (e -> STM a) -> m a ...@@ -262,10 +263,14 @@ catchSTM :: (MonadSTM m, Exception e) => STM a -> (e -> STM a) -> m a
catchSTM fx fn = liftSTM (STM.catchSTM fx fn) catchSTM fx fn = liftSTM (STM.catchSTM fx fn)
{-# INLINABLE catchSTM #-} {-# INLINABLE catchSTM #-}
catchSTM' :: (MonadSTM' r t m, Exception e) => STM' r CanThrow a -> (e -> STM' r t a) -> m a catchSTM' :: (MonadSTM' r CanThrow m, Exception e) => STM' r CanThrow a -> (e -> STM' r CanThrow a) -> m a
catchSTM' fx fn = unsafeLimitSTM $ STM.catchSTM (runSTM' fx) \ex -> runSTM' (fn ex) catchSTM' fx fn = unsafeLimitSTM $ STM.catchSTM (runSTM' fx) \ex -> runSTM' (fn ex)
{-# INLINABLE catchSTM' #-} {-# INLINABLE catchSTM' #-}
catchAllSTM' :: (MonadSTM' r t m) => STM' r CanThrow a -> (SomeException -> STM' r t a) -> m a
catchAllSTM' fx fn = unsafeLimitSTM $ STM.catchSTM (runSTM' fx) \ex -> runSTM' (fn ex)
{-# INLINABLE catchAllSTM' #-}
-- | Creates a new object of type `Unique`. The value returned will not compare -- | Creates a new object of type `Unique`. The value returned will not compare
-- equal to any other value of type 'Unique' returned by previous calls to -- equal to any other value of type 'Unique' returned by previous calls to
-- `newUnique` and `newUniqueSTM`. There is no limit on the number of times -- `newUnique` and `newUniqueSTM`. There is no limit on the number of times
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment