Skip to content

Commit

Permalink
polymorphic m
Browse files Browse the repository at this point in the history
  • Loading branch information
parsonsmatt committed Dec 14, 2024
1 parent b7eeb56 commit 828ea03
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions resourcet/Control/Monad/Trans/Resource.hs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ runResourceT :: MonadUnliftIO m => ResourceT m a -> m a
runResourceT action = withRunInIO $ \run -> do
E.mask_ $ do
(a, cleanup) <- run $ evalResourceT action
cleanup
run cleanup
pure a

-- | Like 'runResourceT', but this one does *not* run the cleanup action
Expand All @@ -201,15 +201,15 @@ runResourceT action = withRunInIO $ \run -> do
-- cursed.
--
-- @since 1.3.1
evalResourceT :: MonadUnliftIO m => ResourceT m a -> m (a, IO ())
evalResourceT :: MonadUnliftIO m => ResourceT m a -> m (a, m ())
evalResourceT (ResourceT r) = withRunInIO $ \run -> do
istate <- createInternalState
E.mask $ \restore -> do
res <- restore (run (r istate)) `E.catch` \e -> do
stateCleanupChecked (Just e) istate
E.throwIO e

return (res, stateCleanupChecked Nothing istate)
return (res, liftIO $ stateCleanupChecked Nothing istate)

-- | Backwards compatible alias for 'runResourceT'.
--
Expand Down

0 comments on commit 828ea03

Please sign in to comment.