packages feed

generic-arbitrary 0.2.1 → 0.2.2

raw patch · 3 files changed

+12/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+0.2.2+-----++* Resolved an issue where the size of the generators could become negative+ 0.2.1 ----- 
generic-arbitrary.cabal view
@@ -1,5 +1,5 @@ name:                generic-arbitrary-version:             0.2.1+version:             0.2.2 synopsis:            Generic implementation for QuickCheck's Arbitrary description:     Generic implementations of methods of the 'Arbitrary' class from the
src/Test/QuickCheck/Arbitrary/Generic.hs view
@@ -65,7 +65,10 @@   gArbitrary = pure G.U1  instance Arbitrary c => GArbitrary (G.K1 i c) where-  gArbitrary = G.K1 <$> arbitrary+  gArbitrary = G.K1 <$> scale predNat arbitrary+    where+      predNat 0 = 0+      predNat n = pred n  instance GArbitrary f => GArbitrary (G.M1 i c f) where   gArbitrary = G.M1 <$> gArbitrary@@ -82,8 +85,8 @@ instance (GArbitrary a, GArbitrary b, KnownNat (SumLen a), KnownNat (SumLen b)          ) => GArbitrary (a G.:+: b) where   gArbitrary = frequency-    [ (lfreq, G.L1 <$> QC.scale pred gArbitrary)-    , (rfreq, G.R1 <$> QC.scale pred gArbitrary) ]+    [ (lfreq, G.L1 <$> gArbitrary)+    , (rfreq, G.R1 <$> gArbitrary) ]     where       lfreq = fromIntegral $ natVal (Proxy :: Proxy (SumLen a))       rfreq = fromIntegral $ natVal (Proxy :: Proxy (SumLen b))