packages feed

QuickCheck 2.18.0.0 → 2.19.0.0

raw patch · 10 files changed

+67/−41 lines, 10 filesdep +OneTuplePVP ok

version bump matches the API change (PVP)

Dependencies added: OneTuple

API changes (from Hackage documentation)

+ Test.QuickCheck.Modifiers: instance Test.QuickCheck.Arbitrary.Arbitrary1 Test.QuickCheck.Modifiers.Blind
+ Test.QuickCheck.Modifiers: instance Test.QuickCheck.Arbitrary.Arbitrary1 Test.QuickCheck.Modifiers.Fixed
+ Test.QuickCheck.Modifiers: instance Test.QuickCheck.Arbitrary.Arbitrary1 Test.QuickCheck.Modifiers.NoShrink
+ Test.QuickCheck.Modifiers: instance Test.QuickCheck.Arbitrary.Arbitrary1 Test.QuickCheck.Modifiers.Shrink2
+ Test.QuickCheck.Modifiers: instance Test.QuickCheck.Arbitrary.Arbitrary1 Test.QuickCheck.Modifiers.Smart

Files

QuickCheck.cabal view
@@ -1,5 +1,5 @@ Name: QuickCheck-Version: 2.18.0.0+Version: 2.19.0.0 Cabal-Version: >= 1.10 Build-type: Simple License: BSD3@@ -146,6 +146,9 @@    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)
changelog.md view
@@ -1,5 +1,11 @@ ## UNRELEASED +## QuickCheck 2.19.0.0 (released 2026-09-16)+* Additional `Arbitrary1` instances +* Add compat instances for `OneTuple`+* Better deprecation warning+* Fix typos (thanks Ang)+ ## QuickCheck 2.18.0.0 (released 2026-02-26) * BREAKING: Added a number of `CoArbitrary` and `Function` instances for types in `base` * Improve implementation of `shrinkIntegral` (thanks tom93)@@ -48,7 +54,7 @@ * Fix withMaxSuccess not working when checkCoverage is turned on * Fix a bug whereby an unfortunately timed discard could unduly fail a property running with checkCoverage-* Fix Arbitrary intance for Map breaking invariants from+* Fix Arbitrary instance for Map breaking invariants from Data.Map.Strict (thanks to Neil Mayhew) * Fix non-covered classes not showing up in output as 0% covered * Fix Negative's Arbitrary instance discarding an unnecessary number
src/Test/QuickCheck/Arbitrary.hs view
@@ -213,6 +213,8 @@  #if MIN_VERSION_base(4,16,0) import Data.Tuple+#else+import Data.Tuple.Solo #endif #endif @@ -1157,17 +1159,6 @@ -- 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@@ -1178,6 +1169,13 @@ #endif  #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
src/Test/QuickCheck/Compat.hs view
@@ -1,30 +1,31 @@ -- 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
src/Test/QuickCheck/Function.hs view
@@ -548,11 +548,12 @@ #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
src/Test/QuickCheck/Modifiers.hs view
@@ -107,10 +107,13 @@ instance Show (Blind a) where   show _ = "(*)" -instance Arbitrary a => Arbitrary (Blind a) where-  arbitrary = Blind `fmap` arbitrary+instance Arbitrary1 Blind where+  liftArbitrary = fmap Blind+  liftShrink shr (Blind x) = [ Blind x' | x' <- shr x ] -  shrink (Blind x) = [ Blind x' | x' <- shrink x ]+instance Arbitrary a => Arbitrary (Blind a) where+  arbitrary = arbitrary1+  shrink = shrink1  -------------------------------------------------------------------------- -- | @Fixed x@: as x, but will not be shrunk.@@ -127,8 +130,11 @@ instance Functor Fixed where   fmap f (Fixed x) = Fixed (f x) +instance Arbitrary1 Fixed where+  liftArbitrary = fmap Fixed+ instance Arbitrary a => Arbitrary (Fixed a) where-  arbitrary = Fixed `fmap` arbitrary+  arbitrary = arbitrary1    -- no shrink function @@ -399,19 +405,22 @@ instance Functor Shrink2 where   fmap f (Shrink2 x) = Shrink2 (f x) -instance Arbitrary a => Arbitrary (Shrink2 a) where-  arbitrary =-    Shrink2 `fmap` arbitrary+instance Arbitrary1 Shrink2 where+  liftArbitrary = fmap Shrink2 -  shrink (Shrink2 x) =+  liftShrink shr (Shrink2 x) =     [ Shrink2 y | y <- shrink_x ] ++     [ Shrink2 z     | y <- shrink_x-    , z <- shrink y+    , z <- shr y     ]    where-    shrink_x = shrink x+    shrink_x = shr x +instance Arbitrary a => Arbitrary (Shrink2 a) where+  arbitrary = arbitrary1+  shrink = shrink1+ -------------------------------------------------------------------------- -- | @NoShrink x@: no shrinking newtype NoShrink a = NoShrink {getNoShrink :: a}@@ -427,8 +436,11 @@ instance Functor NoShrink where   fmap f (NoShrink x) = NoShrink (f x) +instance Arbitrary1 NoShrink where+  liftArbitrary = fmap NoShrink+ instance Arbitrary a => Arbitrary (NoShrink a) where-  arbitrary = fmap NoShrink arbitrary+  arbitrary = arbitrary1  -------------------------------------------------------------------------- -- | @Smart _ x@: tries a different order when shrinking.@@ -441,19 +453,24 @@ instance Show a => Show (Smart a) where   showsPrec n (Smart _ x) = showsPrec n x -instance Arbitrary a => Arbitrary (Smart a) where-  arbitrary =-    do x <- arbitrary+instance Arbitrary1 Smart where+  liftArbitrary arb =+    do x <- arb        return (Smart 0 x) -  shrink (Smart i x) = take i' ys `ilv` drop i' ys+  liftShrink shr (Smart i x) = take i' ys `ilv` drop i' ys    where-    ys = [ Smart j y | (j,y) <- [0..] `zip` shrink x ]+    ys = [ Smart j y | (j,y) <- [0..] `zip` shr x ]     i' = 0 `max` (i-2)      []     `ilv` bs     = bs     as     `ilv` []     = as     (a:as) `ilv` (b:bs) = a : b : (as `ilv` bs)++instance Arbitrary a => Arbitrary (Smart a) where+  arbitrary = arbitrary1++  shrink = shrink1  {-   shrink (Smart i x) = part0 ++ part2 ++ part1
src/Test/QuickCheck/Property.hs view
@@ -523,7 +523,7 @@ -- > quickCheck (withMaxSuccess 1000 p) -- -- will test @p@ up to 1000 times.-{-# DEPRECATED withMaxSuccess "Use withNumTests instead" #-}+{-# DEPRECATED withMaxSuccess "Use `withNumTests` instead" #-} withMaxSuccess :: Testable prop => Int -> prop -> Property withMaxSuccess = withNumTests 
src/Test/QuickCheck/State.hs view
@@ -100,7 +100,7 @@ data TestProgress   = TestProgress   { currentPassed        :: Int -- ^ Number of tests passed so far-  , currentDiscarded     :: Int -- ^ Number of discared tests so far+  , currentDiscarded     :: Int -- ^ Number of discarded tests so far   , maxTests             :: Int -- ^ Number of tests to execute   , currentShrinks       :: Int -- ^ Number of successful shrinking steps   , currentFailedShrinks :: Int -- ^ Number of failed shrinking steps since last successful one
src/Test/QuickCheck/Test.hs view
@@ -585,7 +585,7 @@   (map format .    -- Descending order of occurrences    reverse . sortBy (comparing snd) .-   -- If #occurences the same, sort in increasing order of key+   -- If #occurrences the same, sort in increasing order of key    -- (note: works because sortBy is stable)    reverse . sortBy (comparing fst) $ Map.toList m)   where
tests/Generators.hs view
@@ -206,7 +206,7 @@  -- Double properties: --- We occasionaly generate duplicates.+-- We occasionally generate duplicates. prop_double_duplicate_list :: [Double] -> Property prop_double_duplicate_list xs = expectFailure $ nub xs === xs where   sorted = sort xs