From dd045622f544b11b625687aa893f42cba0998334 Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Wed, 6 May 2026 09:40:23 +0200 Subject: [PATCH 1/8] Start on more instances --- QuickCheck.cabal | 3 +++ src/Test/QuickCheck/Arbitrary.hs | 6 +++--- src/Test/QuickCheck/Compat.hs | 11 +++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/QuickCheck.cabal b/QuickCheck.cabal index fed93e10..ae08ee9f 100644 --- a/QuickCheck.cabal +++ b/QuickCheck.cabal @@ -147,6 +147,9 @@ library if impl(ghc < 9.4) Build-depends: data-array-byte + if impl(ghc < 9.2) + Build-depends: OneTuple + -- Switch off most optional features on non-GHC systems. if !impl(ghc) && !impl(mhs) -- If your Haskell compiler can cope without some of these, please diff --git a/src/Test/QuickCheck/Arbitrary.hs b/src/Test/QuickCheck/Arbitrary.hs index ea68e5b5..4aac4b1a 100644 --- a/src/Test/QuickCheck/Arbitrary.hs +++ b/src/Test/QuickCheck/Arbitrary.hs @@ -213,6 +213,8 @@ import qualified GHC.Exts as Exts #if MIN_VERSION_base(4,16,0) import Data.Tuple +#elif defined(__GHC__) +import Data.Tuple.Solo #endif #endif @@ -1157,15 +1159,13 @@ instance CoArbitrary ByteArray where -- MicroHs does not have Exts.fromList #endif /* !defined(__MHS__) */ -#if MIN_VERSION_base(4,16,0) - +#if defined(__GHC__) instance Arbitrary a => Arbitrary (Solo a) where arbitrary = mkSolo <$> arbitrary shrink = map mkSolo . shrink . getSolo instance CoArbitrary a => CoArbitrary (Solo a) where coarbitrary = coarbitrary . getSolo - #endif instance Arbitrary a => Arbitrary (Down a) where diff --git a/src/Test/QuickCheck/Compat.hs b/src/Test/QuickCheck/Compat.hs index a5c235c7..6c126a81 100644 --- a/src/Test/QuickCheck/Compat.hs +++ b/src/Test/QuickCheck/Compat.hs @@ -4,9 +4,6 @@ module Test.QuickCheck.Compat where #if MIN_VERSION_base(4,16,0) import Data.Tuple -#endif - -#if MIN_VERSION_base(4,16,0) #if !MIN_VERSION_base(4,18,0) @@ -21,14 +18,16 @@ mkSolo = Solo getSolo :: Solo a -> a getSolo (MkSolo a) = a +#endif + mkSolo :: a -> Solo a mkSolo = MkSolo -#else +#elif defined(__GHC__) + +import Data.Tuple.Solo mkSolo :: a -> Solo a mkSolo = MkSolo #endif - -#endif From e3b29603dae2ded7409c233835a03b15af86dd93 Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Wed, 6 May 2026 10:04:37 +0200 Subject: [PATCH 2/8] fucks sake --- src/Test/QuickCheck/Arbitrary.hs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Test/QuickCheck/Arbitrary.hs b/src/Test/QuickCheck/Arbitrary.hs index 4aac4b1a..d491723e 100644 --- a/src/Test/QuickCheck/Arbitrary.hs +++ b/src/Test/QuickCheck/Arbitrary.hs @@ -1159,15 +1159,6 @@ instance CoArbitrary ByteArray where -- MicroHs does not have Exts.fromList #endif /* !defined(__MHS__) */ -#if defined(__GHC__) -instance Arbitrary a => Arbitrary (Solo a) where - arbitrary = mkSolo <$> arbitrary - shrink = map mkSolo . shrink . getSolo - -instance CoArbitrary a => CoArbitrary (Solo a) where - coarbitrary = coarbitrary . getSolo -#endif - instance Arbitrary a => Arbitrary (Down a) where arbitrary = fmap Down arbitrary shrink = map Down . shrink . getDown @@ -1179,6 +1170,13 @@ instance CoArbitrary a => CoArbitrary (Down a) where #ifdef __GLASGOW_HASKELL__ +instance Arbitrary a => Arbitrary (Solo a) where + arbitrary = mkSolo <$> arbitrary + shrink = map mkSolo . shrink . getSolo + +instance CoArbitrary a => CoArbitrary (Solo a) where + coarbitrary = coarbitrary . getSolo + instance Arbitrary a => Arbitrary (ArgDescr a) where arbitrary = oneof [ NoArg <$> arbitrary , ReqArg <$> arbitrary <*> arbitrary From baa8e1d62fd55c0f120fa41cc5ba8b53544a4eb2 Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Wed, 6 May 2026 10:15:37 +0200 Subject: [PATCH 3/8] fucks sake --- src/Test/QuickCheck/Compat.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Test/QuickCheck/Compat.hs b/src/Test/QuickCheck/Compat.hs index 6c126a81..46b29e49 100644 --- a/src/Test/QuickCheck/Compat.hs +++ b/src/Test/QuickCheck/Compat.hs @@ -1,5 +1,6 @@ -- This module provides tools to simplify compat code across different compiler and library versions {-# LANGUAGE CPP #-} +{-# OPTIONS_GHC -Wno-deprecations #-} module Test.QuickCheck.Compat where #if MIN_VERSION_base(4,16,0) @@ -10,9 +11,6 @@ import Data.Tuple getSolo :: Solo a -> a getSolo (Solo a) = a -mkSolo :: a -> Solo a -mkSolo = Solo - #elif !MIN_VERSION_base(4,19,0) getSolo :: Solo a -> a @@ -21,7 +19,7 @@ getSolo (MkSolo a) = a #endif mkSolo :: a -> Solo a -mkSolo = MkSolo +mkSolo = Solo #elif defined(__GHC__) From 1ad014581cc548a88d9b5286d8b340f794ac482c Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Wed, 6 May 2026 10:18:50 +0200 Subject: [PATCH 4/8] more plausible by the minute --- src/Test/QuickCheck/Compat.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Test/QuickCheck/Compat.hs b/src/Test/QuickCheck/Compat.hs index 46b29e49..2c0fb962 100644 --- a/src/Test/QuickCheck/Compat.hs +++ b/src/Test/QuickCheck/Compat.hs @@ -3,6 +3,8 @@ {-# OPTIONS_GHC -Wno-deprecations #-} module Test.QuickCheck.Compat where +#ifdef __GLASGOW_HASKELL__ + #if MIN_VERSION_base(4,16,0) import Data.Tuple @@ -21,7 +23,7 @@ getSolo (MkSolo a) = a mkSolo :: a -> Solo a mkSolo = Solo -#elif defined(__GHC__) +#else import Data.Tuple.Solo @@ -29,3 +31,5 @@ mkSolo :: a -> Solo a mkSolo = MkSolo #endif + +#endif From dd9837647f3d7bdfef2e42db2cbc0e9ca9f63aeb Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Wed, 6 May 2026 10:21:50 +0200 Subject: [PATCH 5/8] what a mess --- src/Test/QuickCheck/Arbitrary.hs | 2 +- src/Test/QuickCheck/Function.hs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Test/QuickCheck/Arbitrary.hs b/src/Test/QuickCheck/Arbitrary.hs index d491723e..6088d6f5 100644 --- a/src/Test/QuickCheck/Arbitrary.hs +++ b/src/Test/QuickCheck/Arbitrary.hs @@ -213,7 +213,7 @@ import qualified GHC.Exts as Exts #if MIN_VERSION_base(4,16,0) import Data.Tuple -#elif defined(__GHC__) +#else import Data.Tuple.Solo #endif #endif diff --git a/src/Test/QuickCheck/Function.hs b/src/Test/QuickCheck/Function.hs index 38954530..34e5acb6 100644 --- a/src/Test/QuickCheck/Function.hs +++ b/src/Test/QuickCheck/Function.hs @@ -548,13 +548,14 @@ instance Function Version where #if !defined(__MHS__) instance Function ByteArray where function = functionMap Exts.toList Exts.fromList -#endif #if MIN_VERSION_base(4,16,0) instance Function a => Function (Solo a) where function = functionMap getSolo mkSolo #endif +#endif + instance Function a => Function (Down a) where function = functionMap getDown Down From 97c3523365202d5a4b0eeed4737e552e6d24b911 Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Wed, 6 May 2026 10:22:45 +0200 Subject: [PATCH 6/8] ignore mhs output --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fe4eb60e..392536cc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ \#* .\#* *.swp - quickcheck-hugs/ hugs.output +Main +Main.hs +mhs.output From e779ea200d6319345424133474e64012fbb7fae9 Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Wed, 6 May 2026 10:27:35 +0200 Subject: [PATCH 7/8] stack nonsense --- .github/workflows/haskell-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 0343a979..5f8c255c 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -71,7 +71,7 @@ jobs: ghc-version: ${{matrix.ghc-version}} enable-stack: true - run: | - printf "snapshot: ${{ matrix.resolver }}\npackages: [.]\nextra-deps: [data-array-byte-0.1.0.1]\nsystem-ghc: true" > stack.yaml + printf "snapshot: ${{ matrix.resolver }}\npackages: [.]\nextra-deps: [data-array-byte-0.1.0.1,OneTuple-0.4.2.1]\nsystem-ghc: true" > stack.yaml cat stack.yaml - uses: actions/cache@v4 with: From 6c855dcc2c939cdb97b4eeedc4012ec67fbf56da Mon Sep 17 00:00:00 2001 From: Maximilian Algehed Date: Wed, 6 May 2026 10:32:46 +0200 Subject: [PATCH 8/8] drop ancient stack nonsense --- .github/workflows/haskell-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 5f8c255c..22fe6c95 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -58,7 +58,6 @@ jobs: - {"resolver": lts-21.25, "ghc-version": "9.4.8"} - {"resolver": lts-20.26, "ghc-version": "9.2.8"} - {"resolver": lts-19.33, "ghc-version": "9.0.2"} - - {"resolver": lts-18.28, "ghc-version": "8.10.7"} fail-fast: false runs-on: ubuntu-latest