Skip to content

Commit

Permalink
Add missing HasCallStack constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
queezle42 committed Jun 4, 2024
1 parent 74296b2 commit 066248d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions quasar/src/Quasar/Resources/Rc.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ tryReadRcIO :: MonadIO m => Rc a -> m (Maybe a)
tryReadRcIO (Rc var) = liftIO do
(.content) <<$>> tryReadDisposableVarIO var

readRc :: MonadSTMc NoRetry '[DisposedException] m => Rc a -> m a
readRc ::
(MonadSTMc NoRetry '[DisposedException] m, HasCallStack) =>
Rc a -> m a
readRc rc = liftSTMc @NoRetry @'[DisposedException] do
maybe (throwC mkDisposedException) pure =<< tryReadRc rc

readRcIO :: MonadIO m => Rc a -> m a
readRcIO :: (MonadIO m, HasCallStack) => Rc a -> m a
readRcIO rc = liftIO do
maybe (throwIO mkDisposedException) pure =<< tryReadRcIO rc

Expand All @@ -112,12 +114,12 @@ tryDuplicateRc (Rc var) = liftSTMc @NoRetry @'[] do
Rc <$> newSpecialDisposableVar decrementRc rc

duplicateRc ::
(HasCallStack, MonadSTMc NoRetry '[DisposedException] m) =>
(MonadSTMc NoRetry '[DisposedException] m, HasCallStack) =>
Rc a -> m (Rc a)
duplicateRc rc = liftSTMc @NoRetry @'[DisposedException] do
maybe (throwC mkDisposedException) pure =<< tryDuplicateRc rc

consumeRc :: Rc a -> (a -> IO b) -> IO b
consumeRc :: HasCallStack => Rc a -> (a -> IO b) -> IO b
consumeRc rc fn = do
flip finally (dispose rc) do
tryReadRcIO rc >>= \case
Expand Down

0 comments on commit 066248d

Please sign in to comment.