diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 0343a979..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 @@ -71,7 +70,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: 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 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..6088d6f5 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 +#else +import Data.Tuple.Solo #endif #endif @@ -1157,17 +1159,6 @@ instance CoArbitrary ByteArray where -- MicroHs does not have Exts.fromList #endif /* !defined(__MHS__) */ -#if MIN_VERSION_base(4,16,0) - -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 diff --git a/src/Test/QuickCheck/Compat.hs b/src/Test/QuickCheck/Compat.hs index a5c235c7..2c0fb962 100644 --- a/src/Test/QuickCheck/Compat.hs +++ b/src/Test/QuickCheck/Compat.hs @@ -1,31 +1,32 @@ -- 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) -import Data.Tuple -#endif +#ifdef __GLASGOW_HASKELL__ #if MIN_VERSION_base(4,16,0) +import Data.Tuple #if !MIN_VERSION_base(4,18,0) 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 getSolo (MkSolo a) = a +#endif + mkSolo :: a -> Solo a -mkSolo = MkSolo +mkSolo = Solo #else +import Data.Tuple.Solo + mkSolo :: a -> Solo a mkSolo = MkSolo 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