summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNickSmallbone <>2019-06-30 19:57:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-06-30 19:57:00 (GMT)
commitc575d0c8d294c8c5de1d45bb9b94e05f4e65a202 (patch)
treec023d64070dfb10f3ba526b8072160f87817b6ff
parenta8d200c4ef789992d46c0dfab13c4e6d5487c162 (diff)
version 2.13.2HEAD2.13.2master
-rw-r--r--QuickCheck.cabal14
-rw-r--r--[-rwxr-xr-x]Setup.lhs0
-rw-r--r--Test/QuickCheck.hs1
-rw-r--r--Test/QuickCheck/Function.hs10
-rw-r--r--Test/QuickCheck/Gen.hs5
-rw-r--r--Test/QuickCheck/Monadic.hs2
-rw-r--r--changelog8
7 files changed, 35 insertions, 5 deletions
diff --git a/QuickCheck.cabal b/QuickCheck.cabal
index 4d307fd..e8cb193 100644
--- a/QuickCheck.cabal
+++ b/QuickCheck.cabal
@@ -1,5 +1,5 @@
Name: QuickCheck
-Version: 2.13.1
+Version: 2.13.2
Cabal-Version: >= 1.8
Build-type: Simple
License: BSD3
@@ -56,14 +56,22 @@ source-repository head
source-repository this
type: git
location: https://github.com/nick8325/quickcheck
- tag: 2.13.1
+ tag: 2.13.2
flag templateHaskell
Description: Build Test.QuickCheck.All, which uses Template Haskell.
Default: True
library
- Build-depends: base >=4.3 && <5, random, containers
+ Build-depends: base >=4.3 && <5, random >=1.0.0.3 && <1.2, containers
+
+ -- random is explicitly Trustworthy since 1.0.1.0
+ -- similar constraint for containers
+ -- Note: QuickCheck is Safe only with GHC >= 7.4 (see below)
+ if impl(ghc >= 7.2)
+ Build-depends: random >=1.0.1.0
+ if impl(ghc >= 7.4)
+ Build-depends: containers >=0.4.2.1
-- Modules that are always built.
Exposed-Modules:
diff --git a/Setup.lhs b/Setup.lhs
index e2c31e7..e2c31e7 100755..100644
--- a/Setup.lhs
+++ b/Setup.lhs
diff --git a/Test/QuickCheck.hs b/Test/QuickCheck.hs
index 7c75f63..89c013c 100644
--- a/Test/QuickCheck.hs
+++ b/Test/QuickCheck.hs
@@ -171,6 +171,7 @@ module Test.QuickCheck
, functionIntegral
, functionRealFrac
, functionBoundedEnum
+ , functionVoid
#endif
-- * The 'CoArbitrary' typeclass: generation of functions the old-fashioned way
diff --git a/Test/QuickCheck/Function.hs b/Test/QuickCheck/Function.hs
index 85e629b..59ae608 100644
--- a/Test/QuickCheck/Function.hs
+++ b/Test/QuickCheck/Function.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE TypeOperators, GADTs, CPP #-}
+{-# LANGUAGE TypeOperators, GADTs, CPP, Rank2Types #-}
#ifndef NO_SAFE_HASKELL
{-# LANGUAGE Safe #-}
#endif
@@ -48,6 +48,7 @@ module Test.QuickCheck.Function
, functionIntegral
, functionRealFrac
, functionBoundedEnum
+ , functionVoid
#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708
, pattern Fn
, pattern Fn2
@@ -174,6 +175,13 @@ functionIntegral = functionMap fromIntegral fromInteger
functionShow :: (Show a, Read a) => (a->c) -> (a:->c)
functionShow f = functionMap show read f
+-- | Provides a 'Function' instance for types isomorphic to 'Data.Void.Void'.
+--
+-- An actual @'Function' 'Data.Void.Void'@ instance is defined in
+-- @quickcheck-instances@.
+functionVoid :: (forall b. void -> b) -> void :-> c
+functionVoid _ = Nil
+
-- | The basic building block for 'Function' instances.
-- Provides a 'Function' instance by mapping to and from a type that
-- already has a 'Function' instance.
diff --git a/Test/QuickCheck/Gen.hs b/Test/QuickCheck/Gen.hs
index 33eea41..449c8e7 100644
--- a/Test/QuickCheck/Gen.hs
+++ b/Test/QuickCheck/Gen.hs
@@ -189,6 +189,11 @@ oneof gs = choose (0,length gs - 1) >>= (gs !!)
-- The input list must be non-empty.
frequency :: [(Int, Gen a)] -> Gen a
frequency [] = error "QuickCheck.frequency used with empty list"
+frequency xs
+ | any (< 0) (map fst xs) =
+ error "QuickCheck.frequency: negative weight"
+ | all (== 0) (map fst xs) =
+ error "QuickCheck.frequency: all weights were zero"
frequency xs0 = choose (1, tot) >>= (`pick` xs0)
where
tot = sum (map fst xs0)
diff --git a/Test/QuickCheck/Monadic.hs b/Test/QuickCheck/Monadic.hs
index a8f3043..1d1015e 100644
--- a/Test/QuickCheck/Monadic.hs
+++ b/Test/QuickCheck/Monadic.hs
@@ -123,7 +123,9 @@ instance Applicative (PropertyM m) where
instance Monad m => Monad (PropertyM m) where
return = pure
(>>=) = bind
+#if !MIN_VERSION_base(4,13,0)
fail = fail_
+#endif
#ifndef NO_MONADFAIL
instance Monad m => Fail.MonadFail (PropertyM m) where
diff --git a/changelog b/changelog
index 93486d0..63e7919 100644
--- a/changelog
+++ b/changelog
@@ -1,4 +1,10 @@
-QuickCheck 2.13.1 (release 2019-03-29)
+QuickCheck 2.13.2 (released 2019-06-30)
+ * Compatibility with GHC 8.8 (thanks to Bodigrim)
+ * Improve error message when 'frequency' is used with only zero weights
+ * Add 'functionVoid' combinator (thanks to Oleg Grenrus)
+ * Tighten bounds for random package (thanks to Oleg Grenrus)
+
+QuickCheck 2.13.1 (released 2019-03-29)
* A couple of bug fixes
QuickCheck 2.13 (released 2019-03-26)