From b7b6d1dccef0b7f1a47d12c7e308e6ce3d00aab1 Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Sun, 21 Jan 2024 11:37:45 -0500 Subject: [PATCH 1/5] allow filepath version < 1.6 --- lens.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lens.cabal b/lens.cabal index 69600aadc..64d71801b 100644 --- a/lens.cabal +++ b/lens.cabal @@ -185,7 +185,7 @@ library contravariant >= 1.4 && < 2, distributive >= 0.5.1 && < 1, exceptions >= 0.8.2.1 && < 1, - filepath >= 1.2.0.0 && < 1.5, + filepath >= 1.2.0.0 && < 1.6, free >= 5.1.5 && < 6, ghc-prim, hashable >= 1.2.7.0 && < 1.5, From d4b206213ef70c4864a3957103beb6f345dcd191 Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Sun, 10 Mar 2024 16:07:24 -0400 Subject: [PATCH 2/5] MonadReader instance for CPS RWST --- lens.cabal | 2 +- src/Control/Lens/Zoom.hs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lens.cabal b/lens.cabal index 69600aadc..166576545 100644 --- a/lens.cabal +++ b/lens.cabal @@ -192,7 +192,7 @@ library indexed-traversable >= 0.1 && < 0.2, indexed-traversable-instances >= 0.1 && < 0.2, kan-extensions >= 5 && < 6, - mtl >= 2.2.1 && < 2.4, + mtl >= 2.3 && < 2.4, parallel >= 3.2.1.0 && < 3.3, profunctors >= 5.5.2 && < 6, reflection >= 2.1 && < 3, diff --git a/src/Control/Lens/Zoom.hs b/src/Control/Lens/Zoom.hs index 5ef78c597..64fc55426 100644 --- a/src/Control/Lens/Zoom.hs +++ b/src/Control/Lens/Zoom.hs @@ -46,6 +46,7 @@ import Control.Monad.Trans.Writer.Lazy as Lazy import Control.Monad.Trans.Writer.Strict as Strict import Control.Monad.Trans.RWS.Lazy as Lazy import Control.Monad.Trans.RWS.Strict as Strict +import Control.Monad.Trans.RWS.CPS as CPS import Control.Monad.Trans.Except import Control.Monad.Trans.Identity import Control.Monad.Trans.Maybe @@ -102,6 +103,7 @@ type instance Magnified (ReaderT b m) = Effect m 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 +type instance Magnified (CPS.RWST a w s m) = EffectRWS w s m type instance Magnified (IdentityT m) = Magnified m ------------------------------------------------------------------------------ @@ -274,6 +276,10 @@ instance (Monad m, Monoid w) => Magnify (Lazy.RWST b w s m) (Lazy.RWST a w s m) magnify l (Lazy.RWST m) = Lazy.RWST $ getEffectRWS #. l (EffectRWS #. m) {-# INLINE magnify #-} +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 #-} + instance Magnify m n b a => Magnify (IdentityT m) (IdentityT n) b a where magnify l (IdentityT m) = IdentityT (magnify l m) {-# INLINE magnify #-} From 14e28b1487c1b0595f83dfc86678087dd47f235f Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Thu, 14 Mar 2024 11:15:25 -0400 Subject: [PATCH 3/5] compiles instance of Magnify for CPS.RWST if mtl version >= 2.3 --- lens.cabal | 2 +- src/Control/Lens/Zoom.hs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lens.cabal b/lens.cabal index 166576545..69600aadc 100644 --- a/lens.cabal +++ b/lens.cabal @@ -192,7 +192,7 @@ library indexed-traversable >= 0.1 && < 0.2, indexed-traversable-instances >= 0.1 && < 0.2, kan-extensions >= 5 && < 6, - mtl >= 2.3 && < 2.4, + mtl >= 2.2.1 && < 2.4, parallel >= 3.2.1.0 && < 3.3, profunctors >= 5.5.2 && < 6, reflection >= 2.1 && < 3, diff --git a/src/Control/Lens/Zoom.hs b/src/Control/Lens/Zoom.hs index 64fc55426..fc9febd23 100644 --- a/src/Control/Lens/Zoom.hs +++ b/src/Control/Lens/Zoom.hs @@ -276,9 +276,11 @@ instance (Monad m, Monoid w) => Magnify (Lazy.RWST b w s m) (Lazy.RWST a w s m) 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) From 4f5c3d920e9ec456d967f77bebbc0c06b2c1f1ef Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Thu, 14 Mar 2024 11:15:25 -0400 Subject: [PATCH 4/5] compiles instance of Magnify for CPS.RWST if mtl version >= 2.3 --- lens.cabal | 2 +- src/Control/Lens/Zoom.hs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lens.cabal b/lens.cabal index 166576545..69600aadc 100644 --- a/lens.cabal +++ b/lens.cabal @@ -192,7 +192,7 @@ library indexed-traversable >= 0.1 && < 0.2, indexed-traversable-instances >= 0.1 && < 0.2, kan-extensions >= 5 && < 6, - mtl >= 2.3 && < 2.4, + mtl >= 2.2.1 && < 2.4, parallel >= 3.2.1.0 && < 3.3, profunctors >= 5.5.2 && < 6, reflection >= 2.1 && < 3, diff --git a/src/Control/Lens/Zoom.hs b/src/Control/Lens/Zoom.hs index 64fc55426..fc9febd23 100644 --- a/src/Control/Lens/Zoom.hs +++ b/src/Control/Lens/Zoom.hs @@ -276,9 +276,11 @@ instance (Monad m, Monoid w) => Magnify (Lazy.RWST b w s m) (Lazy.RWST a w s m) 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) From f88e239e25a994848fe3f8c7e0953b87396ab93c Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Sun, 5 May 2024 10:44:46 -0400 Subject: [PATCH 5/5] CPP min version of mtl for CPS --- lens.cabal | 2 +- src/Control/Lens/Zoom.hs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lens.cabal b/lens.cabal index 64d71801b..69600aadc 100644 --- a/lens.cabal +++ b/lens.cabal @@ -185,7 +185,7 @@ library contravariant >= 1.4 && < 2, distributive >= 0.5.1 && < 1, exceptions >= 0.8.2.1 && < 1, - filepath >= 1.2.0.0 && < 1.6, + filepath >= 1.2.0.0 && < 1.5, free >= 5.1.5 && < 6, ghc-prim, hashable >= 1.2.7.0 && < 1.5, diff --git a/src/Control/Lens/Zoom.hs b/src/Control/Lens/Zoom.hs index fc9febd23..030ee4b7a 100644 --- a/src/Control/Lens/Zoom.hs +++ b/src/Control/Lens/Zoom.hs @@ -46,7 +46,9 @@ import Control.Monad.Trans.Writer.Lazy as Lazy 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 @@ -103,7 +105,9 @@ type instance Magnified (ReaderT b m) = Effect m 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 ------------------------------------------------------------------------------