QuickCheck 2.7 → 2.7.1
raw patch · 2 files changed
+13/−5 lines, 2 filesdep ~QuickCheck
Dependency ranges changed: QuickCheck
Files
- QuickCheck.cabal +2/−2
- Test/QuickCheck/Arbitrary.hs +11/−3
QuickCheck.cabal view
@@ -1,5 +1,5 @@ Name: QuickCheck-Version: 2.7+Version: 2.7.1 Cabal-Version: >= 1.8 Build-type: Simple License: BSD3@@ -34,7 +34,7 @@ source-repository this type: git location: https://github.com/nick8325/quickcheck- tag: 2.7+ tag: 2.7.1 flag base3 Description: Choose the new smaller, split-up base package.
Test/QuickCheck/Arbitrary.hs view
@@ -433,11 +433,19 @@ -- | Generates an integral number. The number can be positive or negative -- and its maximum absolute value depends on the size parameter.-arbitrarySizedIntegral :: Num a => Gen a+arbitrarySizedIntegral :: Integral a => Gen a arbitrarySizedIntegral = sized $ \n ->- let n' = toInteger n in- fmap fromInteger (choose (-n', n'))+ withoutOverflow (toInteger n) $ \n' _ ->+ withoutOverflow (negate (toInteger n)) $ \m' _ ->+ fmap fromInteger (choose (m', n'))++withoutOverflow :: Integral a => Integer -> (Integer -> a -> Gen a) -> Gen a+withoutOverflow n k+ | toInteger n' == n = k n n'+ | otherwise = k 0 0+ where+ n' = fromInteger n -- | Generates a fractional number. The number can be positive or negative -- and its maximum absolute value depends on the size parameter.