lens 5.3 → 5.3.1
raw patch · 3 files changed
+18/−1 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Control.Lens.Zoom: instance (GHC.Base.Monad m, GHC.Base.Monoid w, Control.Monad.Reader.Class.MonadReader b (Control.Monad.Trans.RWS.CPS.RWST b w s m)) => Control.Lens.Zoom.Magnify (Control.Monad.Trans.RWS.CPS.RWST b w s m) (Control.Monad.Trans.RWS.CPS.RWST a w s m) b a
Files
- CHANGELOG.markdown +5/−0
- lens.cabal +1/−1
- src/Control/Lens/Zoom.hs +12/−0
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+5.3.1 [2024.05.05]+------------------+* Add a `Magnify` instance for the CPS variant of `RWST` when building with+ `mtl-2.3` or later.+ 5.3 [2024.05.04] ---------------- * Allow building with GHC 9.10.
lens.cabal view
@@ -1,6 +1,6 @@ name: lens category: Data, Lenses, Generics-version: 5.3+version: 5.3.1 license: BSD2 cabal-version: 1.18 license-file: LICENSE
src/Control/Lens/Zoom.hs view
@@ -46,6 +46,9 @@ import Control.Monad.Trans.Writer.Strict as Strict import Control.Monad.Trans.RWS.Lazy as Lazy import Control.Monad.Trans.RWS.Strict as Strict+#if MIN_VERSION_mtl(2,3,0)+import Control.Monad.Trans.RWS.CPS as CPS+#endif import Control.Monad.Trans.Except import Control.Monad.Trans.Identity import Control.Monad.Trans.Maybe@@ -102,6 +105,9 @@ type instance Magnified ((->)b) = Const type instance Magnified (Strict.RWST a w s m) = EffectRWS w s m type instance Magnified (Lazy.RWST a w s m) = EffectRWS w s m+#if MIN_VERSION_mtl(2,3,0)+type instance Magnified (CPS.RWST a w s m) = EffectRWS w s m+#endif type instance Magnified (IdentityT m) = Magnified m ------------------------------------------------------------------------------@@ -273,6 +279,12 @@ instance (Monad m, Monoid w) => Magnify (Lazy.RWST b w s m) (Lazy.RWST a w s m) b a where magnify l (Lazy.RWST m) = Lazy.RWST $ getEffectRWS #. l (EffectRWS #. m) {-# INLINE magnify #-}++#if MIN_VERSION_mtl(2,3,0)+instance (Monad m, Monoid w, MonadReader b (CPS.RWST b w s m)) => Magnify (CPS.RWST b w s m) (CPS.RWST a w s m) b a where+ magnify l m = CPS.rwsT $ getEffectRWS #. l (EffectRWS #. CPS.runRWST m)+ {-# INLINE magnify #-}+#endif instance Magnify m n b a => Magnify (IdentityT m) (IdentityT n) b a where magnify l (IdentityT m) = IdentityT (magnify l m)