packages feed

QuickCheck 2.14.1 → 2.14.2

raw patch · 6 files changed

+57/−14 lines, 6 filesdep ~basedep ~template-haskellPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, template-haskell

API changes (from Hackage documentation)

- Test.QuickCheck.Arbitrary: instance Data.Fixed.HasResolution a => Test.QuickCheck.Arbitrary.Arbitrary (Data.Fixed.Fixed a)
- Test.QuickCheck.Arbitrary: instance Data.Fixed.HasResolution a => Test.QuickCheck.Arbitrary.CoArbitrary (Data.Fixed.Fixed a)
- Test.QuickCheck.Function: instance Data.Fixed.HasResolution a => Test.QuickCheck.Function.Function (Data.Fixed.Fixed a)
- Test.QuickCheck.Modifiers: instance GHC.Arr.Ix a => GHC.Arr.Ix (Test.QuickCheck.Modifiers.Large a)
- Test.QuickCheck.Modifiers: instance GHC.Arr.Ix a => GHC.Arr.Ix (Test.QuickCheck.Modifiers.Small a)
+ Test.QuickCheck.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary a => Test.QuickCheck.Arbitrary.Arbitrary (Data.Tree.Tree a)
+ Test.QuickCheck.Arbitrary: instance Test.QuickCheck.Arbitrary.Arbitrary1 Data.Tree.Tree
+ Test.QuickCheck.Arbitrary: instance Test.QuickCheck.Arbitrary.CoArbitrary a => Test.QuickCheck.Arbitrary.CoArbitrary (Data.Tree.Tree a)
+ Test.QuickCheck.Arbitrary: instance forall k (a :: k). Data.Fixed.HasResolution a => Test.QuickCheck.Arbitrary.Arbitrary (Data.Fixed.Fixed a)
+ Test.QuickCheck.Arbitrary: instance forall k (a :: k). Data.Fixed.HasResolution a => Test.QuickCheck.Arbitrary.CoArbitrary (Data.Fixed.Fixed a)
+ Test.QuickCheck.Function: instance Test.QuickCheck.Function.Function a => Test.QuickCheck.Function.Function (Data.Tree.Tree a)
+ Test.QuickCheck.Function: instance forall k (a :: k). Data.Fixed.HasResolution a => Test.QuickCheck.Function.Function (Data.Fixed.Fixed a)
+ Test.QuickCheck.Modifiers: instance GHC.Ix.Ix a => GHC.Ix.Ix (Test.QuickCheck.Modifiers.Large a)
+ Test.QuickCheck.Modifiers: instance GHC.Ix.Ix a => GHC.Ix.Ix (Test.QuickCheck.Modifiers.Small a)

Files

QuickCheck.cabal view
@@ -1,5 +1,5 @@ Name: QuickCheck-Version: 2.14.1+Version: 2.14.2 Cabal-Version: >= 1.10 Build-type: Simple License: BSD3@@ -57,7 +57,7 @@ source-repository this   type:     git   location: https://github.com/nick8325/quickcheck-  tag:      2.14.1+  tag:      2.14.2  flag templateHaskell   Description: Build Test.QuickCheck.All, which uses Template Haskell.
changelog view
@@ -1,4 +1,8 @@-QuickCheck 2.14.1 (release 2020-07-05)+QuickCheck 2.14.2 (released 2020-11-14)+	* Add Arbitrary instances for Tree (thanks to Oleg Grenrus)+	* GHC 9.0 compatibility (thanks to Vilem-Benjamin Liepelt)++QuickCheck 2.14.1 (released 2020-07-05) 	* Compatibility with random >= 1.2.  QuickCheck 2.14 (released 2020-03-28)
examples/Heap.hs view
@@ -1,8 +1,6 @@ {-# LANGUAGE ScopedTypeVariables, TemplateHaskell #-} module Main where -import Data.Int- -------------------------------------------------------------------------- -- imports @@ -146,7 +144,7 @@ -- main  return []-main = $forAllProperties (quickCheckWithResult stdArgs{maxSuccess = 10000})+main = $quickCheckAll  -------------------------------------------------------------------------- -- the end.
src/Test/QuickCheck/All.hs view
@@ -98,16 +98,21 @@ #endif  deconstructType :: Error -> Type -> Q ([Name], Cxt, Type)-deconstructType err ty0@(ForallT xs ctx ty) = do-  let plain (PlainTV  _)       = True-#if MIN_VERSION_template_haskell(2,8,0)-      plain (KindedTV _ StarT) = True+deconstructType err (ForallT xs ctx ty) = do+#if MIN_VERSION_template_haskell(2,17,0)+  let plain (PlainTV nm _)        = return nm+      plain (KindedTV nm _ StarT) = return nm #else-      plain (KindedTV _ StarK) = True+  let plain (PlainTV nm)          = return nm+#  if MIN_VERSION_template_haskell(2,8,0)+      plain (KindedTV nm StarT)   = return nm+#  else+      plain (KindedTV nm StarK)   = return nm+#  endif #endif-      plain _                  = False-  unless (all plain xs) $ err "Higher-kinded type variables in type"-  return (map (\(PlainTV x) -> x) xs, ctx, ty)+      plain _                     = err "Higher-kinded type variables in type"+  xs' <- mapM plain xs+  return (xs', ctx, ty) deconstructType _ ty = return ([], [], ty)  monomorphiseType :: Error -> Type -> Type -> TypeQ
src/Test/QuickCheck/Arbitrary.hs view
@@ -159,6 +159,7 @@ import qualified Data.IntSet as IntSet import qualified Data.IntMap as IntMap import qualified Data.Sequence as Sequence+import qualified Data.Tree as Tree import Data.Bits  import qualified Data.Monoid as Monoid@@ -821,7 +822,36 @@ instance Arbitrary a => Arbitrary (Sequence.Seq a) where   arbitrary = arbitrary1   shrink = shrink1+instance Arbitrary1 Tree.Tree where+    liftArbitrary arb = sized $ \n -> do+        k <- chooseInt (0, n)+        go k+      where+        go n = do -- n is the size of the trees.+            value <- arb+            pars <- arbPartition (n - 1) -- can go negative!+            forest <- mapM go pars+            return $ Tree.Node value forest +        arbPartition :: Int -> Gen [Int]+        arbPartition k = case compare k 1 of+            LT -> pure []+            EQ -> pure [1]+            GT -> do+                first <- chooseInt (1, k)+                rest <- arbPartition $ k - first+                shuffle (first : rest)++    liftShrink shr = go+      where+        go (Tree.Node val forest) = forest +++            [ Tree.Node e fs+            | (e, fs) <- liftShrink2 shr (liftShrink go) (val, forest)+            ]+instance Arbitrary a => Arbitrary (Tree.Tree a) where+  arbitrary = arbitrary1+  shrink = shrink1+ -- Arbitrary instance for Ziplist instance Arbitrary1 ZipList where   liftArbitrary = fmap ZipList . liftArbitrary@@ -1360,6 +1390,8 @@   coarbitrary = coarbitrary . IntMap.toList instance CoArbitrary a => CoArbitrary (Sequence.Seq a) where   coarbitrary = coarbitrary . toList+instance CoArbitrary a => CoArbitrary (Tree.Tree a) where+  coarbitrary (Tree.Node val forest) = coarbitrary val . coarbitrary forest  -- CoArbitrary instance for Ziplist instance CoArbitrary a => CoArbitrary (ZipList a) where
src/Test/QuickCheck/Function.hs view
@@ -76,6 +76,7 @@ import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.Sequence as Sequence+import qualified Data.Tree as Tree import Data.Int import Data.Complex import Data.Foldable(toList)@@ -338,6 +339,9 @@  instance Function a => Function (Sequence.Seq a) where   function = functionMap toList Sequence.fromList++instance Function a => Function (Tree.Tree a) where+  function = functionMap (\(Tree.Node x xs) -> (x,xs)) (uncurry Tree.Node)  instance Function Int8 where   function = functionBoundedEnum