Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
\#*
.\#*
*.swp

quickcheck-hugs/
hugs.output
Main
Main.hs
mhs.output
3 changes: 3 additions & 0 deletions QuickCheck.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 9 additions & 11 deletions src/Test/QuickCheck/Arbitrary.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 8 additions & 7 deletions src/Test/QuickCheck/Compat.hs
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 2 additions & 1 deletion src/Test/QuickCheck/Function.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading