resourcet 0.3.1 → 0.3.2
raw patch · 2 files changed
+52/−4 lines, 2 filesdep ~transformersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: transformers
API changes (from Hackage documentation)
+ Control.Monad.Trans.Resource: type MonadResourceBase m = (MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m, MonadIO m, Applicative m)
Files
- Control/Monad/Trans/Resource.hs +50/−2
- resourcet.cabal +2/−2
Control/Monad/Trans/Resource.hs view
@@ -6,6 +6,9 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-}+#if __GLASGOW_HASKELL__ >= 704+{-# LANGUAGE ConstraintKinds #-}+#endif -- | Allocate resources which are guaranteed to be released. -- -- For more information, see <http://www.yesodweb.com/book/conduits>.@@ -31,6 +34,7 @@ , MonadUnsafeIO (..) , MonadThrow (..) , MonadActive (..)+ , MonadResourceBase -- ** Low-level , InvalidAccess (..) -- * Re-exports@@ -73,8 +77,21 @@ import qualified Control.Monad.Trans.Writer.Strict as Strict ( WriterT ) import Control.Concurrent (ThreadId, forkIO) -import Control.Monad.ST (ST, unsafeIOToST)+import Control.Monad.ST (ST)+#if __GLASGOW_HASKELL__ >= 704+import Control.Monad.ST.Unsafe (unsafeIOToST)+#else+import Control.Monad.ST (unsafeIOToST)+#endif++#if __GLASGOW_HASKELL__ >= 704+import qualified Control.Monad.ST.Lazy.Unsafe as LazyUnsafe+#else+import qualified Control.Monad.ST.Lazy as LazyUnsafe+#endif+ import qualified Control.Monad.ST.Lazy as Lazy+ import Data.Functor.Identity (Identity) -- | A lookup key for a specific release action. This value is returned by@@ -110,7 +127,11 @@ goType :: Typeable1 m => m a -> ResourceT m a -> TypeRep goType m _ = mkTyConApp+#if __GLASGOW_HASKELL__ >= 704+ (mkTyCon3 "resourcet" "Control.Monad.Trans.Resource" "ResourceT")+#else (mkTyCon "Control.Monad.Trans.Resource.ResourceT")+#endif [ typeOf1 m ] @@ -446,7 +467,7 @@ unsafeLiftIO = unsafeIOToST instance MonadUnsafeIO (Lazy.ST s) where- unsafeLiftIO = Lazy.unsafeIOToST+ unsafeLiftIO = LazyUnsafe.unsafeIOToST instance (MonadTrans t, MonadUnsafeIO m, Monad (t m)) => MonadUnsafeIO (t m) where unsafeLiftIO = lift . unsafeLiftIO@@ -494,3 +515,30 @@ GOX(Monoid w, Strict.WriterT w) #undef GO #undef GOX++-- | A @Monad@ which can be used as a base for a @ResourceT@.+--+-- A @ResourceT@ has some restrictions on its base monad:+--+-- * @runResourceT@ requires an instance of @MonadBaseControl IO@.+-- * @MonadResource@ requires an instance of @MonadThrow@, @MonadUnsafeIO@, @MonadIO@, and @Applicative@.+--+-- While any instance of @MonadBaseControl IO@ should be an instance of the+-- other classes, this is not guaranteed by the type system (e.g., you may have+-- a transformer in your stack with does not implement @MonadThrow@). Ideally,+-- we would like to simply create an alias for the five type classes listed,+-- but this is not possible with GHC currently.+--+-- Instead, this typeclass acts as a proxy for the other five. Its only purpose+-- is to make your type signatures shorter.+--+-- Note that earlier versions of @conduit@ had a typeclass @ResourceIO@. This+-- fulfills much the same role.+--+-- Since 0.3.2+#if __GLASGOW_HASKELL__ >= 704+type MonadResourceBase m = (MonadBaseControl IO m, MonadThrow m, MonadUnsafeIO m, MonadIO m, Applicative m)+#else+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
resourcet.cabal view
@@ -1,5 +1,5 @@ Name: resourcet-Version: 0.3.1+Version: 0.3.2 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>.@@ -19,7 +19,7 @@ , transformers-base >= 0.4.1 && < 0.5 , monad-control >= 0.3.1 && < 0.4 , containers- , transformers >= 0.2.2 && < 0.3+ , transformers >= 0.2.2 && < 0.4 ghc-options: -Wall source-repository head