packages feed

monad-unlift 0.1.0.1 → 0.1.1.0

raw patch · 6 files changed

+24/−5 lines, 6 filesdep +resourcetPVP ok

version bump matches the API change (PVP)

Dependencies added: resourcet

API changes (from Hackage documentation)

+ Control.Monad.Trans.RWS.Ref: instance MonadResource m => MonadResource (RWSRefT refw refs r w s m)
+ Control.Monad.Trans.State.Ref: instance MonadResource m => MonadResource (StateRefT ref s m)
+ Control.Monad.Trans.Writer.Ref: instance MonadResource m => MonadResource (WriterRefT ref w m)

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.1.1.0++* Add `MonadResource` instances+ ## 0.1.0.0  * Initial release
Control/Monad/Trans/RWS/Ref.hs view
@@ -32,6 +32,7 @@ import           Control.Monad.Trans.Control (defaultLiftBaseWith,                                               defaultRestoreM) import           Control.Monad.Trans.Unlift+import           Control.Monad.Trans.Resource (MonadResource (..)) import           Data.Monoid                 (Monoid, mappend, mempty) import           Data.Mutable                (IORef, MCState, MutableRef,                                               PrimMonad, PrimState, RealWorld,@@ -214,3 +215,7 @@       where q :: (m a -> m a) -> RWSRefT refw refs r w s m a -> RWSRefT refw refs r w s m a             q u (RWSRefT b) = RWSRefT (\r w s -> u (b r w s))   {-# INLINE uninterruptibleMask #-}++instance MonadResource m => MonadResource (RWSRefT refw refs r w s m) where+    liftResourceT = lift . liftResourceT+    {-# INLINE liftResourceT #-}
Control/Monad/Trans/State/Ref.hs view
@@ -26,6 +26,7 @@ import           Control.Monad.Trans.Control (defaultLiftBaseWith,                                               defaultRestoreM) import           Control.Monad.Trans.Unlift+import           Control.Monad.Trans.Resource (MonadResource (..)) import           Data.Mutable                (IORef, MCState, MutableRef,                                               PrimMonad, PrimState, RealWorld,                                               RefElement, STRef, newRef,@@ -155,3 +156,7 @@       where q :: (m a -> m a) -> StateRefT ref s m a -> StateRefT ref s m a             q u (StateRefT b) = StateRefT (u . b)   {-# INLINE uninterruptibleMask #-}++instance MonadResource m => MonadResource (StateRefT ref s m) where+    liftResourceT = lift . liftResourceT+    {-# INLINE liftResourceT #-}
Control/Monad/Trans/Writer/Ref.hs view
@@ -30,6 +30,7 @@ import           Control.Monad.Trans.Control (defaultLiftBaseWith,                                               defaultRestoreM) import           Control.Monad.Trans.Unlift+import           Control.Monad.Trans.Resource (MonadResource (..)) import           Control.Monad.Writer.Class import           Data.Monoid                 (Monoid, mappend, mempty) import           Data.Mutable                (IORef, MCState, MutableRef,@@ -174,3 +175,7 @@       where q :: (m a -> m a) -> WriterRefT ref w m a -> WriterRefT ref w m a             q u (WriterRefT b) = WriterRefT (u . b)   {-# INLINE uninterruptibleMask #-}++instance MonadResource m => MonadResource (WriterRefT ref w m) where+    liftResourceT = lift . liftResourceT+    {-# INLINE liftResourceT #-}
README.md view
@@ -18,8 +18,7 @@ myFunc :: RWSRefT     -- The WriterT piece is contained by an IORef     IORef-    -- For efficiency, we store the state in a primitive-    -- reference for efficiency+    -- For efficiency, we store the state in a primitive reference     (PRef RealWorld)     SomeEnv   -- Reader     [String]  -- Writer@@ -199,7 +198,7 @@ instance.  To address this case, this package includes variants of those transformers that-use mutable references. These reference are generic using the+use mutable references. These references are generic using the [mutable-containers](http://www.stackage.org/package/mutable-containers) package, which allows you to have highly efficient references like `PRef` instead of always using boxed references like `IORef`.@@ -223,7 +222,7 @@  Both the `HandlerT` transformer from yesod-core and `LoggingT`/`NoLoggingT` are valid monad morphisms. `HandlerT` is in fact my first example of using the-"enviornment holding a mutable reference" technique to overcome exceptions+"environment holding a mutable reference" technique to overcome exceptions destroying state.  ```haskell
monad-unlift.cabal view
@@ -1,5 +1,5 @@ name:                monad-unlift-version:             0.1.0.1+version:             0.1.1.0 synopsis:            Typeclasses for representing monad transformer unlifting description:         See README.md homepage:            https://github.com/fpco/monad-unlift@@ -27,4 +27,5 @@                      , exceptions >= 0.6                      , stm                      , constraints+                     , resourcet   default-language:    Haskell2010