packages feed

resourcet 1.1.9 → 1.1.10

raw patch · 6 files changed

+43/−3 lines, 6 filesdep +unliftio-corePVP ok

version bump matches the API change (PVP)

Dependencies added: unliftio-core

API changes (from Hackage documentation)

+ Control.Monad.Trans.Resource.Internal: instance Control.Monad.IO.Unlift.MonadUnliftIO m => Control.Monad.IO.Unlift.MonadUnliftIO (Control.Monad.Trans.Resource.Internal.ResourceT m)
+ UnliftIO.Resource: liftResourceT :: MonadIO m => ResourceT IO a -> ResourceT m a
+ UnliftIO.Resource: runResourceT :: MonadUnliftIO m => ResourceT m a -> m a

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.1.10++* Added `MonadUnliftIO` instances and `UnliftIO.Resource`+ ## 1.1.9  * Add generalized version of resourceForkIO
Control/Monad/Trans/Resource.hs view
@@ -100,7 +100,7 @@ release (ReleaseKey istate rk) = liftIO $ release' istate rk     (maybe (return ()) id) --- | Unprotect resource from cleanup actions, this allowes you to send+-- | Unprotect resource from cleanup actions; this allows you to send -- resource into another resourcet process and reregister it there. -- It returns an release action that should be run in order to clean -- resource or Nothing in case if resource is already freed.
Control/Monad/Trans/Resource/Internal.hs view
@@ -33,6 +33,7 @@ import Control.Applicative (Applicative (..), Alternative(..)) import Control.Monad (MonadPlus(..)) import Control.Monad.Fix (MonadFix(..))+import Control.Monad.IO.Unlift import Control.Monad.Trans.Control     ( MonadTransControl (..), MonadBaseControl (..) ) import Control.Monad.Base (MonadBase, liftBase)@@ -288,6 +289,12 @@              f $ liftM StMT . runInBase . (\(ResourceT r) -> r reader'  )      restoreM (StMT base) = ResourceT $ const $ restoreM base #endif++-- | @since 1.1.10+instance MonadUnliftIO m => MonadUnliftIO (ResourceT m) where+  askUnliftIO = ResourceT $ \r ->+                withUnliftIO $ \u ->+                return (UnliftIO (unliftIO u . flip unResourceT r))  #define GO(T) instance (MonadResource m) => MonadResource (T m) where liftResourceT = lift . liftResourceT #define GOX(X, T) instance (X, MonadResource m) => MonadResource (T m) where liftResourceT = lift . liftResourceT
README.md view
@@ -42,7 +42,7 @@     "This could take a long time, don't delay releasing the resource!" ``` -Try entering a valid value, such as 3, and then enter 0. Notice that in both cases the "Freeing scarce resource" message it printed. And by using `release` before `somethingElse`, we guarantee that the resource is freed *before* running the potentially long process.+Try entering a valid value, such as 3, and then enter 0. Notice that in both cases the "Freeing scarce resource" message is printed. And by using `release` before `somethingElse`, we guarantee that the resource is freed *before* running the potentially long process.  In this specific case, we could easily represent our code in terms of bracket with a little refactoring. 
+ UnliftIO/Resource.hs view
@@ -0,0 +1,27 @@+-- | Unlifted "Control.Monad.Trans.Resource".+--+-- @since 1.1.10+module UnliftIO.Resource+  ( -- * UnliftIO variants+    runResourceT+  , liftResourceT+    -- * Reexports+  , module Control.Monad.Trans.Resource+  ) where++import qualified Control.Monad.Trans.Resource as Res+import Control.Monad.Trans.Resource.Internal (ResourceT (..))+import Control.Monad.IO.Unlift+import Control.Monad.Trans.Resource (ResourceT, ReleaseKey, allocate, register, release, unprotect, MonadResource)++-- | Unlifted version of 'Res.runResourceT'.+--+-- @since 1.1.10+runResourceT :: MonadUnliftIO m => ResourceT m a -> m a+runResourceT m = withRunInIO $ \run -> Res.runResourceT $ Res.transResourceT run m++-- | Lifted version of 'Res.liftResourceT'.+--+-- @since 1.1.10+liftResourceT :: MonadIO m => ResourceT IO a -> ResourceT m a+liftResourceT (ResourceT f) = ResourceT $ liftIO . f
resourcet.cabal view
@@ -1,5 +1,5 @@ Name:                resourcet-Version:             1.1.9+Version:             1.1.10 Synopsis:            Deterministic allocation and freeing of scarce resources. description:         Hackage documentation generation is not reliable. For up to date documentation, please see: <http://www.stackage.org/package/resourcet>. License:             BSD3@@ -17,6 +17,7 @@                        Control.Monad.Trans.Resource.Internal                        Data.Acquire                        Data.Acquire.Internal+                       UnliftIO.Resource   Build-depends:       base                     >= 4.5          && < 5                      , lifted-base              >= 0.1                      , transformers-base        >= 0.4.4        && < 0.5@@ -27,6 +28,7 @@                      , mtl                      >= 2.0          && < 2.3                      , mmorph                      , exceptions               >= 0.5+                     , unliftio-core   ghc-options:     -Wall  test-suite test