packages feed

genvalidity 0.5.0.3 → 0.5.1.0

raw patch · 3 files changed

+101/−28 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Data.GenValidity: instance Data.GenValidity.GenInvalid a => Data.GenValidity.GenInvalid (Data.List.NonEmpty.NonEmpty a)
- Data.GenValidity: instance Data.GenValidity.GenUnchecked a => Data.GenValidity.GenUnchecked (Data.List.NonEmpty.NonEmpty a)
- Data.GenValidity: instance Data.GenValidity.GenValid a => Data.GenValidity.GenValid (Data.List.NonEmpty.NonEmpty a)
+ Data.GenValidity: instance Data.GenValidity.GenInvalid a => Data.GenValidity.GenInvalid (GHC.Base.NonEmpty a)
+ Data.GenValidity: instance Data.GenValidity.GenUnchecked GHC.Natural.Natural
+ Data.GenValidity: instance Data.GenValidity.GenUnchecked a => Data.GenValidity.GenUnchecked (GHC.Base.NonEmpty a)
+ Data.GenValidity: instance Data.GenValidity.GenValid GHC.Natural.Natural
+ Data.GenValidity: instance Data.GenValidity.GenValid a => Data.GenValidity.GenValid (GHC.Base.NonEmpty a)

Files

genvalidity.cabal view
@@ -1,11 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.20.0.+-- This file has been generated from package.yaml by hpack version 0.28.2. -- -- see: https://github.com/sol/hpack ----- hash: dce5893ecff9eeace7dc7d30e9caa9764336390820e112683bbea5ff82892fc6+-- hash: 75f45c202b686df17dfa4b7d2a4c2d401bb0c8e9a9437f40d008cef1de3ef380  name:           genvalidity-version:        0.5.0.3+version:        0.5.1.0 synopsis:       Testing utilities for the validity library description:    Note: There are companion instance packages for this library:                 .@@ -32,7 +32,8 @@ homepage:       https://github.com/NorfairKing/validity#readme bug-reports:    https://github.com/NorfairKing/validity/issues author:         Tom Sydney Kerckhove-maintainer:     syd.kerckhove@gmail.com+maintainer:     syd.kerckhove@gmail.com,+                nick.van.den.broeck666@gmail.com copyright:      Copyright: (c) 2016-2018 Tom Sydney Kerckhove license:        MIT license-file:   LICENSE@@ -44,6 +45,11 @@   location: https://github.com/NorfairKing/validity  library+  exposed-modules:+      Data.GenValidity+      Data.GenRelativeValidity+  other-modules:+      Paths_genvalidity   hs-source-dirs:       src   build-depends:@@ -52,16 +58,15 @@     , validity >=0.5   if impl(ghc >=8.0.0)     ghc-options: -Wno-redundant-constraints-  exposed-modules:-      Data.GenValidity-      Data.GenRelativeValidity-  other-modules:-      Paths_genvalidity   default-language: Haskell2010  test-suite genvalidity-test   type: exitcode-stdio-1.0   main-is: Spec.hs+  other-modules:+      Data.GenValiditySpec+      Data.InstanceSpec+      Paths_genvalidity   hs-source-dirs:       test   ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fno-warn-name-shadowing@@ -70,8 +75,4 @@     , base     , genvalidity     , hspec-  other-modules:-      Data.GenValiditySpec-      Data.InstanceSpec-      Paths_genvalidity   default-language: Haskell2010
src/Data/GenValidity.hs view
@@ -54,6 +54,9 @@ {-# LANGUAGE OverlappingInstances  #-} #define OVERLAPPING_ #endif+#if MIN_VERSION_base(4,9,0)+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+#endif  module Data.GenValidity     ( module Data.Validity@@ -66,16 +69,25 @@ #if MIN_VERSION_base(4,9,0) import Data.List.NonEmpty (NonEmpty((:|))) #endif+#if MIN_VERSION_base(4,8,0)+import Data.Word (Word8, Word16, Word32, Word64)+#else import Data.Word (Word, Word8, Word16, Word32, Word64)-import Data.Int (Int, Int8, Int16, Int32, Int64)+#endif+import Data.Int (Int8, Int16, Int32, Int64) import Data.Ratio ((%)) import GHC.Generics import GHC.Real (Ratio(..))  import Test.QuickCheck hiding (Fixed) +#if MIN_VERSION_base(4,8,0)+import GHC.Natural+import Control.Monad (forM)+#else import Control.Applicative ((<*>), (<$>), pure) import Control.Monad (forM)+#endif  {-# ANN module "HLint: ignore Reduce duplication" #-} @@ -476,24 +488,32 @@  instance GenUnchecked Float where     genUnchecked = arbitrary+#if MIN_VERSION_QuickCheck(2,9,2)     shrinkUnchecked = shrink+#else+    shrinkUnchecked _ = []+#endif  instance GenValid Float where     genValid = arbitrary  -- | Either 'NaN' or 'Infinity'. instance GenInvalid Float where-    genInvalid = elements [read "NaN", read "Infinity"]+    genInvalid = elements [read "NaN", read "Infinity", read "-Infinity", read "-0"]  instance GenUnchecked Double where     genUnchecked = arbitrary+#if MIN_VERSION_QuickCheck(2,9,2)     shrinkUnchecked = shrink+#else+    shrinkUnchecked _ = []+#endif  instance GenValid Double  -- | Either 'NaN' or 'Infinity'. instance GenInvalid Double where-    genInvalid = elements [read "NaN", read "Infinity"]+    genInvalid = elements [read "NaN", read "Infinity", read "-Infinity", read "-0"]  instance GenUnchecked Integer where     genUnchecked = arbitrary@@ -501,6 +521,16 @@  instance GenValid Integer +#if MIN_VERSION_base(4,8,0)+instance GenUnchecked Natural where+    genUnchecked = fromInteger . abs <$> genUnchecked+    shrinkUnchecked 0 = []+    shrinkUnchecked n = [0 .. n-1]++instance GenValid Natural where+    genValid = fromInteger . abs <$> genValid+#endif+ instance (Integral a, GenUnchecked a) => GenUnchecked (Ratio a) where     genUnchecked = do         n <- genUnchecked@@ -538,7 +568,7 @@ upTo :: Int -> Gen Int upTo n     | n <= 0 = pure 0-    | otherwise = elements [0 .. n]+    | otherwise = choose (0, n)  -- | 'genSplit a' generates a tuple '(b, c)' such that 'b + c' equals 'a'. genSplit :: Int -> Gen (Int, Int)@@ -583,7 +613,7 @@ arbPartition k     | k <= 0 = pure []     | otherwise = do-        first <- elements [1 .. k]+        first <- choose (1, k)         rest <- arbPartition $ k - first         return $ first : rest @@ -631,8 +661,7 @@  instance (GUncheckedRecursivelyShrink f, GUncheckedRecursivelyShrink g) => GUncheckedRecursivelyShrink (f :*: g) where   gUncheckedRecursivelyShrink (x :*: y) =-      [x' :*: y | x' <- gUncheckedRecursivelyShrink x] ++-      [x :*: y' | y' <- gUncheckedRecursivelyShrink y]+      [x' :*: y' | x' <- gUncheckedRecursivelyShrink x, y' <- gUncheckedRecursivelyShrink y]  instance (GUncheckedRecursivelyShrink f, GUncheckedRecursivelyShrink g) => GUncheckedRecursivelyShrink (f :+: g) where   gUncheckedRecursivelyShrink (L1 x) = map L1 (gUncheckedRecursivelyShrink x)
test/Data/InstanceSpec.hs view
@@ -4,7 +4,10 @@ module Data.InstanceSpec     ( spec     ) where-+#if !MIN_VERSION_base(4,8,0)+import Control.Applicative ((<*>), pure)+import Data.Functor ((<$>))+#endif import Data.Data import Data.Int #if MIN_VERSION_base(4,9,0)@@ -18,9 +21,9 @@  import Test.Hspec import Test.QuickCheck--import Control.Applicative (pure)-+#if MIN_VERSION_base(4,8,0)+import GHC.Natural+#endif import Data.GenValidity  spec :: Spec@@ -41,26 +44,66 @@     twoTests (Proxy :: Proxy Int64)     twoTests (Proxy :: Proxy Integer)     threeTests (Proxy :: Proxy Float)+    threeTupleTests (Proxy :: Proxy Float)     threeTests (Proxy :: Proxy Double)-    threeTests (Proxy :: Proxy (Double, Double))-    threeTests (Proxy :: Proxy (Double, Double, Double))-    threeTests (Proxy :: Proxy (Double, Double, Double, Double))-    threeTests (Proxy :: Proxy (Double, Double, Double, Double, Double))+    threeTupleTests (Proxy :: Proxy Double)+    threeTests (Proxy :: Proxy Rational)+    threeTupleTests (Proxy :: Proxy Rational)     threeTests (Proxy :: Proxy (Either Double Double))     threeTests (Proxy :: Proxy (Maybe Double))+    threeTests (Proxy :: Proxy (Maybe (Maybe Double)))     threeTests (Proxy :: Proxy [Double])     threeTests (Proxy :: Proxy (Ratio Integer))+    threeTests (Proxy :: Proxy (Ratio Integer))+    threeTupleTests (Proxy :: Proxy (Ratio Integer))     threeTests (Proxy :: Proxy (Ratio Int))+    threeTupleTests (Proxy :: Proxy (Ratio Int))     twoTests (Proxy :: Proxy Uni)+    twoTupleTests (Proxy :: Proxy Uni)     twoTests (Proxy :: Proxy Deci)+    twoTupleTests (Proxy :: Proxy Deci)     twoTests (Proxy :: Proxy Centi)+    twoTupleTests (Proxy :: Proxy Centi)     twoTests (Proxy :: Proxy Milli)+    twoTupleTests (Proxy :: Proxy Milli)     twoTests (Proxy :: Proxy Micro)+    twoTupleTests (Proxy :: Proxy Micro)     twoTests (Proxy :: Proxy Nano)+    twoTupleTests (Proxy :: Proxy Nano)     twoTests (Proxy :: Proxy Pico)+    twoTupleTests (Proxy :: Proxy Pico)+#if MIN_VERSION_base(4,8,0)+    twoTests (Proxy :: Proxy Natural)+    +    twoTupleTests (Proxy :: Proxy Natural)+    +    twoTests (Proxy :: Proxy (Ratio Integer))+    +    twoTupleTests (Proxy :: Proxy (Ratio Int))+#endif #if MIN_VERSION_base(4,9,0)     threeTests (Proxy :: Proxy (NonEmpty Double)) #endif+twoTupleTests ::+       forall a. (Show a, Typeable a, GenValid a)+    => Proxy a+    -> Spec+twoTupleTests proxy = do+    twoTests $ (,) <$> proxy <*> proxy+    twoTests $ (,,) <$> proxy <*> proxy <*> proxy+    twoTests $ (,,,) <$> proxy <*> proxy <*> proxy <*> proxy+    twoTests $ (,,,,) <$> proxy <*> proxy <*> proxy <*> proxy <*> proxy++threeTupleTests ::+       forall a. (Show a, Typeable a, GenValid a, GenInvalid a)+    => Proxy a+    -> Spec+threeTupleTests proxy = do+    threeTests $ (,) <$> proxy <*> proxy+    threeTests $ (,,) <$> proxy <*> proxy <*> proxy+    threeTests $ (,,,) <$> proxy <*> proxy <*> proxy <*> proxy+    threeTests $ (,,,,) <$> proxy <*> proxy <*> proxy <*> proxy <*> proxy+ twoTests ::        forall a. (Show a, Typeable a, GenValid a)     => Proxy a