From 14e28b1487c1b0595f83dfc86678087dd47f235f Mon Sep 17 00:00:00 2001 From: William Rusnack Date: Thu, 14 Mar 2024 11:15:25 -0400 Subject: [PATCH] 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)