packages feed

resourcet 0.4.5 → 0.4.6

raw patch · 2 files changed

+52/−2 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Monad.Trans.Resource: getInternalState :: Monad m => ResourceT m InternalState
+ Control.Monad.Trans.Resource: instance MonadIO m => MonadIO (ExceptionT m)
+ Control.Monad.Trans.Resource: instance MonadResource m => MonadResource (ExceptionT m)
+ Control.Monad.Trans.Resource: joinResourceT :: ResourceT (ResourceT m) a -> ResourceT m a
+ Control.Monad.Trans.Resource: runInternalState :: ResourceT m a -> InternalState -> m a
+ Control.Monad.Trans.Resource: type InternalState = IORef ReleaseMap
+ Control.Monad.Trans.Resource: withInternalState :: (InternalState -> m a) -> ResourceT m a

Files

Control/Monad/Trans/Resource.hs view
@@ -27,6 +27,7 @@     , resourceForkIO       -- * Monad transformation     , transResourceT+    , joinResourceT       -- * A specific Exception transformer     , ExceptionT (..)     , runExceptionT_@@ -48,6 +49,12 @@     , InvalidAccess (..)       -- * Re-exports     , MonadBaseControl+      -- * Internal state+      -- $internalState+    , InternalState+    , getInternalState+    , runInternalState+    , withInternalState     ) where  import Data.Typeable@@ -384,6 +391,14 @@                -> ResourceT n b transResourceT f (ResourceT mx) = ResourceT (\r -> f (mx r)) +-- | This function mirrors @join@ at the transformer level: it will collapse+-- two levels of @ResourceT@ into a single @ResourceT@.+--+-- Since 0.4.6+joinResourceT :: ResourceT (ResourceT m) a+              -> ResourceT m a+joinResourceT (ResourceT f) = ResourceT $ \r -> unResourceT (f r) r+ -------- All of our monad et al instances instance Functor m => Functor (ResourceT m) where     fmap f (ResourceT m) = ResourceT $ \r -> fmap f (m r)@@ -424,7 +439,10 @@      restoreM (StMT base) = ResourceT $ const $ restoreM base instance Monad m => MonadThrow (ExceptionT m) where     monadThrow = ExceptionT . return . Left . E.toException-+instance MonadResource m => MonadResource (ExceptionT m) where+    liftResourceT = lift . liftResourceT+instance MonadIO m => MonadIO (ExceptionT m) where+    liftIO = lift . liftIO  -- | The express purpose of this transformer is to allow non-@IO@-based monad -- stacks to catch exceptions via the 'MonadThrow' typeclass.@@ -668,3 +686,35 @@ class (MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m, MonadIO m, Applicative m) => MonadResourceBase m instance (MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m, MonadIO m, Applicative m) => MonadResourceBase m #endif++-- $internalState+--+-- A @ResourceT@ internally is a modified @ReaderT@ monad transformer holding+-- onto a mutable reference to all of the release actions still remaining to be+-- performed. If you are building up a custom application monad, it may be more+-- efficient to embed this @ReaderT@ functionality directly in your own monad+-- instead of wrapping around @ResourceT@ itself. This section provides you the+-- means of doing so.++-- | Get the internal state of the current @ResourceT@.+--+-- Since 0.4.6+getInternalState :: Monad m => ResourceT m InternalState+getInternalState = ResourceT return++-- | The internal state held by a @ResourceT@ transformer.+--+-- Since 0.4.6+type InternalState = I.IORef ReleaseMap++-- | Unwrap a @ResourceT@ using the given @InternalState@.+--+-- Since 0.4.6+runInternalState :: ResourceT m a -> InternalState -> m a+runInternalState = unResourceT++-- | Run an action in the underlying monad, providing it the @InternalState.+--+-- Since 0.4.6+withInternalState :: (InternalState -> m a) -> ResourceT m a+withInternalState = ResourceT
resourcet.cabal view
@@ -1,5 +1,5 @@ Name:                resourcet-Version:             0.4.5+Version:             0.4.6 Synopsis:            Deterministic allocation and freeing of scarce resources. Description: 	This package was originally included with the conduit package, and has since been split off. For more information, please see <http://www.yesodweb.com/book/conduits>.