monad-unlift-ref 0.2.0 → 0.2.1
raw patch · 5 files changed
+79/−44 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Monad.Trans.State.Ref: instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Trans.State.Ref.StateRefT ref s m)
+ Control.Monad.Trans.Writer.Ref: instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (Control.Monad.Trans.Writer.Ref.WriterRefT ref w m)
Files
- ChangeLog.md +5/−0
- Control/Monad/Trans/RWS/Ref.hs +4/−4
- Control/Monad/Trans/State/Ref.hs +16/−4
- Control/Monad/Trans/Writer/Ref.hs +16/−4
- monad-unlift-ref.cabal +38/−32
ChangeLog.md view
@@ -1,3 +1,8 @@+## 0.2.1++* Add `MonadReader` instance for `StateRefT`+* Add `MonadReader` instance for `WriterRefT`+ ## 0.2.0 * Split out monad-unlift-ref
Control/Monad/Trans/RWS/Ref.hs view
@@ -41,7 +41,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 newtype RWSRefT refw refs r w s m a = RWSRefT { unRWSRefT :: r -> refw w -> refs s -> m a }@@ -49,7 +49,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runRWSRefT :: ( Monad m , w ~ RefElement (refw w)@@ -75,7 +75,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runRWSIORefT :: ( Monad m , RealWorld ~ PrimState b@@ -92,7 +92,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runRWSSTRefT :: ( Monad m , ps ~ PrimState b
Control/Monad/Trans/State/Ref.hs view
@@ -22,6 +22,7 @@ import Control.Monad.Catch (MonadCatch (..), MonadMask (..), MonadThrow (..)) import Control.Monad.IO.Class (MonadIO (..))+import Control.Monad.Reader.Class (MonadReader (..)) import Control.Monad.State.Class import Control.Monad.Trans.Control (defaultLiftBaseWith, defaultRestoreM)@@ -34,7 +35,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 newtype StateRefT ref s m a = StateRefT { unStateRefT :: ref s -> m a }@@ -42,7 +43,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runStateRefT :: ( Monad m , s ~ RefElement (ref s)@@ -63,7 +64,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runStateIORefT :: ( Monad m , RealWorld ~ PrimState b@@ -78,7 +79,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runStateSTRefT :: ( Monad m , ps ~ PrimState b@@ -115,6 +116,17 @@ {-# INLINE get #-} put x = seq x $ StateRefT $ liftBase . (`writeRef` x) {-# INLINE put #-}++-- |+--+-- @since 0.2.1+instance MonadReader r m => MonadReader r (StateRefT ref s m) where+ ask = StateRefT $ const ask+ {-# INLINE ask #-}+ local f m = StateRefT $ local f . unStateRefT m+ {-# INLINE local #-}+ reader = StateRefT . const . reader+ {-# INLINE reader #-} instance MonadTrans (StateRefT ref s) where lift = StateRefT . const
Control/Monad/Trans/Writer/Ref.hs view
@@ -27,6 +27,7 @@ import Control.Monad.Catch (MonadCatch (..), MonadMask (..), MonadThrow (..)) import Control.Monad.IO.Class (MonadIO (..))+import Control.Monad.Reader.Class (MonadReader (..)) import Control.Monad.Trans.Control (defaultLiftBaseWith, defaultRestoreM) import Control.Monad.Trans.Unlift@@ -40,7 +41,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 newtype WriterRefT ref w m a = WriterRefT { unWriterRefT :: ref w -> m a }@@ -48,7 +49,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runWriterRefT :: ( Monad m , w ~ RefElement (ref w)@@ -69,7 +70,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runWriterIORefT :: ( Monad m , RealWorld ~ PrimState b@@ -84,7 +85,7 @@ -- | ----- Since 0.1.0+-- @since 0.1.0 runWriterSTRefT :: ( Monad m , ps ~ PrimState b@@ -134,6 +135,17 @@ liftBase $ modifyRef' ref g return a {-# INLINEABLE pass #-}++-- |+--+-- @since 0.2.1+instance MonadReader r m => MonadReader r (WriterRefT ref w m) where+ ask = WriterRefT $ const ask+ {-# INLINE ask #-}+ local f m = WriterRefT $ local f . unWriterRefT m+ {-# INLINE local #-}+ reader = WriterRefT . const . reader+ {-# INLINE reader #-} instance MonadTrans (WriterRefT ref w) where lift = WriterRefT . const
monad-unlift-ref.cabal view
@@ -1,35 +1,41 @@-name: monad-unlift-ref-version: 0.2.0-synopsis: Typeclasses for representing monad transformer unlifting-description: See README.md-homepage: https://github.com/fpco/monad-unlift-license: MIT-license-file: LICENSE-author: Michael Snoyman-maintainer: michael@fpcomplete.com-copyright: FP Complete-category: Control-build-type: Simple-extra-source-files: README.md ChangeLog.md-cabal-version: >=1.10+name: monad-unlift-ref+version: 0.2.1+cabal-version: >=1.10+build-type: Simple+license: MIT+license-file: LICENSE+copyright: FP Complete+maintainer: michael@fpcomplete.com+homepage: https://github.com/fpco/monad-unlift+synopsis: Typeclasses for representing monad transformer unlifting+description:+ See README.md+category: Control+author: Michael Snoyman+extra-source-files:+ README.md+ ChangeLog.md +source-repository head+ type: git+ location: https://github.com/fpco/monad-unlift.git+ library- exposed-modules: Control.Monad.Trans.State.Ref- Control.Monad.Trans.Writer.Ref- Control.Monad.Trans.RWS.Ref- build-depends: base >= 4.6 && < 5- , monad-control >= 1.0 && < 1.1- , monad-unlift >= 0.2 && < 0.3- , transformers- , mtl- , transformers-base- , mutable-containers >= 0.3 && < 0.4- , exceptions >= 0.6- , stm- , constraints- , resourcet- default-language: Haskell2010+ exposed-modules:+ Control.Monad.Trans.State.Ref+ Control.Monad.Trans.Writer.Ref+ Control.Monad.Trans.RWS.Ref+ build-depends:+ base >=4.6 && <5,+ monad-control ==1.0.*,+ monad-unlift ==0.2.*,+ transformers -any,+ mtl -any,+ transformers-base -any,+ mutable-containers ==0.3.*,+ exceptions >=0.6,+ stm -any,+ constraints -any,+ resourcet -any+ default-language: Haskell2010 -source-repository head- type: git- location: https://github.com/fpco/monad-unlift.git