From 0027e914f79a8e1f52558a4f00e3283ad8a23820 Mon Sep 17 00:00:00 2001 From: mniip Date: Mon, 14 Apr 2025 17:57:41 +0200 Subject: [PATCH 1/5] Add and correct version bounds to fix build failures * The library uses `sized`, introduced in QuickCheck 2.8 * The testsuite uses `total`, introduced in QuickCheck 2.10 * tasty-discover >=3 doesn't produce the correct imports for tasty-hunit <=0.9.1. * Similarly tasty-discover <2 doesn't work * tasty >=1.4.0.1 && <=1.4.0.3 seems broken on GHC >=9.4 --- generic-arbitrary.cabal | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/generic-arbitrary.cabal b/generic-arbitrary.cabal index 9c5b357..894c8ce 100644 --- a/generic-arbitrary.cabal +++ b/generic-arbitrary.cabal @@ -31,7 +31,7 @@ source-repository head library exposed-modules: Test.QuickCheck.Arbitrary.Generic build-depends: base >=4.8 && <5 - , QuickCheck + , QuickCheck >=2.8 hs-source-dirs: src default-language: Haskell2010 default-extensions: AllowAmbiguousTypes @@ -59,13 +59,13 @@ test-suite test hs-source-dirs: test main-is: Test.hs default-language: Haskell2010 - build-depends: base >= 4.8 && <5 - , QuickCheck + build-depends: base >=4.12 && <5 + , QuickCheck >=2.10 , deepseq , generic-arbitrary - , tasty - , tasty-discover - , tasty-hunit + , tasty >=1.4.2 || <1.4.0.1 + , tasty-discover >= 2.0.0 + , tasty-hunit >= 0.9.2 , tasty-quickcheck other-modules: Auxiliary , EnumTest From d863022d4f6e6b6aa0b9ebd50abd7eacc8faa7e0 Mon Sep 17 00:00:00 2001 From: mniip Date: Tue, 15 Apr 2025 22:36:45 +0200 Subject: [PATCH 2/5] Upgrade to cabal 2.0 --- generic-arbitrary.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generic-arbitrary.cabal b/generic-arbitrary.cabal index 894c8ce..2803da5 100644 --- a/generic-arbitrary.cabal +++ b/generic-arbitrary.cabal @@ -16,7 +16,7 @@ category: Generic build-type: Simple extra-source-files: CHANGELOG.md , README.md -cabal-version: 1.22 +cabal-version: 2.0 tested-with: GHC == 8.6.5 , GHC == 8.10.7 , GHC == 9.0.2 @@ -94,7 +94,7 @@ test-suite test , TypeSynonymInstances , UndecidableInstances , ViewPatterns - build-tools: tasty-discover + build-tool-depends: tasty-discover:tasty-discover ghc-options: -Wall -threaded -rtsopts From 403bfbca062bb64c4d3c2d75911f0b2a6a86814f Mon Sep 17 00:00:00 2001 From: mniip Date: Tue, 15 Apr 2025 22:37:16 +0200 Subject: [PATCH 3/5] Extend -fconstraint-solver-iterations=6 to newer GHCs --- test/EnumTest.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/EnumTest.hs b/test/EnumTest.hs index 0957cdb..e1ffda6 100644 --- a/test/EnumTest.hs +++ b/test/EnumTest.hs @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 806 && __GLASGOW_HASKELL__ <= 900 {-# OPTIONS_GHC -fconstraint-solver-iterations=5 #-} -#elif __GLASGOW_HASKELL__ >= 902 && __GLASGOW_HASKELL__ <= 908 +#elif __GLASGOW_HASKELL__ >= 902 {-# OPTIONS_GHC -fconstraint-solver-iterations=6 #-} #endif From fa28f06c26251084df29c20fba9d746bf855088d Mon Sep 17 00:00:00 2001 From: mniip Date: Tue, 15 Apr 2025 09:19:17 +0200 Subject: [PATCH 4/5] Some warnings Fixed -Wdodgy-imports Disabled -Wstar-is-type since Data.Kind doesn't exist in GHC-7.10 Disabled -Wunticked-promoted-constructors because it was only temporarily included in -Wall and is no longer recommended in new GHCs. --- generic-arbitrary.cabal | 1 - src/Test/QuickCheck/Arbitrary/Generic.hs | 7 +++++++ test/RecursiveTest.hs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/generic-arbitrary.cabal b/generic-arbitrary.cabal index 2803da5..69e59c8 100644 --- a/generic-arbitrary.cabal +++ b/generic-arbitrary.cabal @@ -99,4 +99,3 @@ test-suite test -threaded -rtsopts "-with-rtsopts=-N -A64m -qb0 -n4m -T -I1" - default-extensions: DeriveGeneric diff --git a/src/Test/QuickCheck/Arbitrary/Generic.hs b/src/Test/QuickCheck/Arbitrary/Generic.hs index 3db83a4..8891b99 100644 --- a/src/Test/QuickCheck/Arbitrary/Generic.hs +++ b/src/Test/QuickCheck/Arbitrary/Generic.hs @@ -1,3 +1,10 @@ +#if __GLASGOW_HASKELL__ >= 806 +{-# OPTIONS_GHC -Wno-star-is-type #-} +#endif +#if __GLASGOW_HASKELL__ >= 800 +{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-} +#endif + {-| This module is a generic implementation of the 'arbitrary' method. Example diff --git a/test/RecursiveTest.hs b/test/RecursiveTest.hs index fbb0aa6..a2c9ad0 100644 --- a/test/RecursiveTest.hs +++ b/test/RecursiveTest.hs @@ -8,7 +8,7 @@ module RecursiveTest where -import Control.DeepSeq hiding (Unit) +import Control.DeepSeq (NFData) import GHC.Generics (Generic) import Test.QuickCheck import Test.QuickCheck.Arbitrary.Generic From edffa8345144cf4390ac5a8a304b831bb3f03e06 Mon Sep 17 00:00:00 2001 From: mniip Date: Tue, 15 Apr 2025 23:39:45 +0200 Subject: [PATCH 5/5] Fix unused import warnings --- src/Test/QuickCheck/Arbitrary/Generic.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Test/QuickCheck/Arbitrary/Generic.hs b/src/Test/QuickCheck/Arbitrary/Generic.hs index 8891b99..1685b5f 100644 --- a/src/Test/QuickCheck/Arbitrary/Generic.hs +++ b/src/Test/QuickCheck/Arbitrary/Generic.hs @@ -153,13 +153,14 @@ module Test.QuickCheck.Arbitrary.Generic ) where import Control.Applicative -import Data.Coerce (coerce) import Data.Proxy import Data.Type.Bool import GHC.Generics as G import GHC.TypeLits +import Prelude import Test.QuickCheck as QC #if MIN_VERSION_QuickCheck(2, 14, 0) +import Data.Coerce (coerce) import Test.QuickCheck.Arbitrary (GSubterms, RecursivelyShrink)