From e2b4e7d77beaa094c8137b9f7a1f860a6469d837 Mon Sep 17 00:00:00 2001 From: sheaf Date: Sat, 2 Jan 2021 14:31:48 +0100 Subject: [PATCH 1/2] GHC 9.0 compatibility --- ChangeLog.md | 3 +++ generic-lens.cabal | 4 ++-- src/Data/Generics/Internal/Profunctor/Iso.hs | 4 ++-- src/Data/Generics/Internal/Profunctor/Prism.hs | 8 ++++---- src/Data/Generics/Product/Internal/Constraints.hs | 4 ++-- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 6c979097..acec16d6 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,6 @@ +## 1.2.0.2 +- Support for GHC 9.0 + ## 1.2.0.1 - Give HasAny/AsAny the same VTA behavior on 8.6 and 8.8 (Ryan Scott) diff --git a/generic-lens.cabal b/generic-lens.cabal index 632dcc4d..29c9b0c6 100644 --- a/generic-lens.cabal +++ b/generic-lens.cabal @@ -1,5 +1,5 @@ name: generic-lens -version: 1.2.0.1 +version: 1.2.0.2 synopsis: Generically derive traversals, lenses and prisms. description: This library uses GHC.Generics to derive efficient optics (traversals, lenses and prisms) for algebraic data types in a type-directed way, with a focus on good type inference and error messages when possible. @@ -11,7 +11,7 @@ maintainer: kiss.csongor.kiss@gmail.com category: Generics, Records, Lens build-type: Simple cabal-version: >= 1.10 -Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1 +Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1, GHC == 8.10.3, GHC == 9.0.1 extra-source-files: ChangeLog.md , examples/StarWars.hs diff --git a/src/Data/Generics/Internal/Profunctor/Iso.hs b/src/Data/Generics/Internal/Profunctor/Iso.hs index de0f0b9c..45dc1eae 100644 --- a/src/Data/Generics/Internal/Profunctor/Iso.hs +++ b/src/Data/Generics/Internal/Profunctor/Iso.hs @@ -75,11 +75,11 @@ fromIso l = withIso l $ \ sa bt -> iso bt sa {-# INLINE fromIso #-} iso :: (s -> a) -> (b -> t) -> Iso s t a b -iso = dimap +iso sa bt = dimap sa bt {-# INLINE iso #-} iso2isovl :: Iso s t a b -> VL.Iso s t a b -iso2isovl _iso = withIso _iso VL.iso +iso2isovl _iso = withIso _iso $ \ sa bt -> VL.iso sa bt {-# INLINE iso2isovl #-} withIso :: Iso s t a b -> ((s -> a) -> (b -> t) -> r) -> r diff --git a/src/Data/Generics/Internal/Profunctor/Prism.hs b/src/Data/Generics/Internal/Profunctor/Prism.hs index 72aacd01..40f99692 100644 --- a/src/Data/Generics/Internal/Profunctor/Prism.hs +++ b/src/Data/Generics/Internal/Profunctor/Prism.hs @@ -64,10 +64,10 @@ match k = withPrism k $ \_ _match -> _match -- Prism stuff without' :: Prism s t a b -> Prism s t c d -> Prism s t (Either a c) (Either b d) -without' k = - withPrism k $ \bt _ k' -> - withPrism k' $ \dt setc -> - prism (either bt dt) $ \s -> fmap Right (setc s) +without' k p = + (withPrism k $ \bt _ k' -> + withPrism k' $ \dt setc -> + prism (either bt dt) $ \s -> fmap Right (setc s)) p {-# INLINE without' #-} withPrism :: APrism s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r diff --git a/src/Data/Generics/Product/Internal/Constraints.hs b/src/Data/Generics/Product/Internal/Constraints.hs index 7af38e10..b25bba34 100644 --- a/src/Data/Generics/Product/Internal/Constraints.hs +++ b/src/Data/Generics/Product/Internal/Constraints.hs @@ -59,7 +59,7 @@ instance gconstraints' f (R1 r) = R1 <$> gconstraints' @c f r instance c a => GHasConstraints' c (Rec0 a) where - gconstraints' = kIso + gconstraints' f = kIso f instance GHasConstraints' c f => GHasConstraints' c (M1 m meta f) where @@ -98,7 +98,7 @@ instance GHasConstraints c V1 V1 where gconstraints _ = pure instance c a b => GHasConstraints c (Rec0 a) (Rec0 b) where - gconstraints = kIso + gconstraints f = kIso f -------------------------------------------------------------------------------- From c265eb236c8264a8a06241d6ea04443a6803c92c Mon Sep 17 00:00:00 2001 From: sheaf Date: Sun, 9 Jan 2022 13:39:34 +0100 Subject: [PATCH 2/2] GHC 9.2 support for v1.2 --- ChangeLog.md | 3 +++ generic-lens.cabal | 4 ++-- src/Data/Generics/Product/Constraints.hs | 1 + src/Data/Generics/Product/Fields.hs | 1 + src/Data/Generics/Product/Internal/HList.hs | 1 + src/Data/Generics/Product/Types.hs | 1 + src/Data/Generics/Sum/Internal/Constructors.hs | 1 + 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index acec16d6..113148cc 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,6 @@ +## 1.2.0.3 +- Support for GHC 9.2 + ## 1.2.0.2 - Support for GHC 9.0 diff --git a/generic-lens.cabal b/generic-lens.cabal index 29c9b0c6..839c4133 100644 --- a/generic-lens.cabal +++ b/generic-lens.cabal @@ -1,5 +1,5 @@ name: generic-lens -version: 1.2.0.2 +version: 1.2.0.3 synopsis: Generically derive traversals, lenses and prisms. description: This library uses GHC.Generics to derive efficient optics (traversals, lenses and prisms) for algebraic data types in a type-directed way, with a focus on good type inference and error messages when possible. @@ -11,7 +11,7 @@ maintainer: kiss.csongor.kiss@gmail.com category: Generics, Records, Lens build-type: Simple cabal-version: >= 1.10 -Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1, GHC == 8.10.3, GHC == 9.0.1 +Tested-With: GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1, GHC == 8.4.4, GHC == 8.6.5, GHC == 8.8.1, GHC == 8.10.3, GHC == 9.0.1, GHC == 9.2.1 extra-source-files: ChangeLog.md , examples/StarWars.hs diff --git a/src/Data/Generics/Product/Constraints.hs b/src/Data/Generics/Product/Constraints.hs index 9a11d283..789dde61 100644 --- a/src/Data/Generics/Product/Constraints.hs +++ b/src/Data/Generics/Product/Constraints.hs @@ -1,5 +1,6 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MultiParamTypeClasses #-} diff --git a/src/Data/Generics/Product/Fields.hs b/src/Data/Generics/Product/Fields.hs index 85f89c62..66370e44 100644 --- a/src/Data/Generics/Product/Fields.hs +++ b/src/Data/Generics/Product/Fields.hs @@ -2,6 +2,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} diff --git a/src/Data/Generics/Product/Internal/HList.hs b/src/Data/Generics/Product/Internal/HList.hs index 42885445..20ab7d31 100644 --- a/src/Data/Generics/Product/Internal/HList.hs +++ b/src/Data/Generics/Product/Internal/HList.hs @@ -1,6 +1,7 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE GADTs #-} diff --git a/src/Data/Generics/Product/Types.hs b/src/Data/Generics/Product/Types.hs index 4ac2a65c..e3b8f1eb 100644 --- a/src/Data/Generics/Product/Types.hs +++ b/src/Data/Generics/Product/Types.hs @@ -2,6 +2,7 @@ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MultiParamTypeClasses #-} diff --git a/src/Data/Generics/Sum/Internal/Constructors.hs b/src/Data/Generics/Sum/Internal/Constructors.hs index 63651a69..9fc596a0 100644 --- a/src/Data/Generics/Sum/Internal/Constructors.hs +++ b/src/Data/Generics/Sum/Internal/Constructors.hs @@ -1,6 +1,7 @@ {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE KindSignatures #-}