quickcheck-instances 0.3.33 → 0.4
raw patch · 7 files changed
+29/−227 lines, 7 filesdep −OneTupledep ~QuickCheckdep ~arraydep ~base
Dependencies removed: OneTuple
Dependency ranges changed: QuickCheck, array, base, bytestring, containers, primitive, splitmix, tagged, text
Files
- CHANGES +6/−0
- quickcheck-instances.cabal +21/−27
- src/Test/QuickCheck/Instances/Natural.hs +0/−23
- src/Test/QuickCheck/Instances/Primitive.hs +0/−32
- src/Test/QuickCheck/Instances/Semigroup.hs +0/−124
- src/Test/QuickCheck/Instances/Solo.hs +0/−21
- test/Tests.hs +2/−0
CHANGES view
@@ -1,3 +1,9 @@+0.4++* Depend on QuickCheck-2.17.1.0+ Drop instances for Natural, ByteArray, Solo, NonEmpty, Data.Semigroup.*+ These should be now provided by QuickCheck package.+ 0.3.33 * Add instances for strict vectors
quickcheck-instances.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: quickcheck-instances-version: 0.3.33+version: 0.4 synopsis: Common quickcheck instances description: QuickCheck instances.@@ -27,9 +27,7 @@ build-type: Simple extra-source-files: CHANGES tested-with:- GHC ==8.6.5- || ==8.8.4- || ==8.10.7+ GHC ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.8@@ -81,31 +79,28 @@ hs-source-dirs: src build-depends: , base >=4.12.0.0 && <4.22- , QuickCheck >=2.14.2 && <2.15.1- , splitmix >=0.1.0.5 && <0.2+ , QuickCheck >=2.17.1.0 && <2.17.2+ , splitmix >=0.1.3.2 && <0.2 build-depends:- , array >=0.5.3.0 && <0.6- , bytestring >=0.10.8.2 && <0.13- , case-insensitive >=1.2.0.11 && <1.3- , containers >=0.6.0.1 && <0.8- , data-fix >=0.3 && <0.4- , hashable >=1.4.4.0 && <1.6+ , array >=0.5.4.0 && <0.6+ , bytestring >=0.10.12.0 && <0.13+ , case-insensitive >=1.2.0.11 && <1.3+ , data-fix >=0.3 && <0.4+ , hashable >=1.4.4.0 && <1.6 , integer-logarithms >=1.0.3.1 && <1.1- , old-time >=1.1.0.0 && <1.2- , OneTuple >=0.4.2 && <0.5- , primitive >=0.9.0.0 && <0.10- , scientific >=0.3.8.0 && <0.4- , strict >=0.5 && <0.6- , tagged >=0.8.8 && <0.9- , text >=1.2.3.0 && <1.3 || >=2.0 && <2.2- , text-short >=0.1.4 && <0.2- , these >=1.2.1 && <1.3- , time-compat >=1.9.4 && <1.10- , transformers >=0.5.6.2 && <0.7- , unordered-containers >=0.2.20 && <0.3- , uuid-types >=1.0.6 && <1.1- , vector >=0.13.2.0 && <0.14+ , old-time >=1.1.0.0 && <1.2+ , scientific >=0.3.8.0 && <0.4+ , strict >=0.5 && <0.6+ , tagged >=0.8.8 && <0.9+ , text >=1.2.4.1 && <1.3 || >=2.0 && <2.2+ , text-short >=0.1.4 && <0.2+ , these >=1.2.1 && <1.3+ , time-compat >=1.9.4 && <1.10+ , transformers >=0.5.6.2 && <0.7+ , unordered-containers >=0.2.20 && <0.3+ , uuid-types >=1.0.6 && <1.1+ , vector >=0.13.2.0 && <0.14 if impl(ghc <9.4) build-depends: data-array-byte >=0.1.0.1 && <0.2@@ -123,7 +118,6 @@ , primitive , QuickCheck , quickcheck-instances- , tagged , uuid-types if impl(ghc >=8.0 && <9.4)
src/Test/QuickCheck/Instances/Natural.hs view
@@ -1,25 +1,2 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Natural () where--import Prelude ()--import Numeric.Natural (Natural)--import Test.QuickCheck- (Arbitrary (..), CoArbitrary (..), arbitrarySizedNatural,- coarbitraryIntegral, shrinkIntegral)-import Test.QuickCheck.Function (Function (..), functionIntegral)------------------------------------------------------------------------------------ nats----------------------------------------------------------------------------------instance Arbitrary Natural where- arbitrary = arbitrarySizedNatural- shrink = shrinkIntegral--instance CoArbitrary Natural where- coarbitrary = coarbitraryIntegral--instance Function Natural where- function = functionIntegral
src/Test/QuickCheck/Instances/Primitive.hs view
@@ -1,34 +1,2 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Primitive () where--import Prelude ()-import Test.QuickCheck.Instances.CustomPrelude--import Data.Word (Word8)--import Test.QuickCheck--import qualified Data.Primitive as P------------------------------------------------------------------------------------ ByteArray------------------------------------------------------------------------------------ | @since 0.3.28-instance Arbitrary P.ByteArray where- arbitrary = byteArrayFromList <$> arbitrary- shrink ba = byteArrayFromList <$> shrink (byteArrayToList ba)---- | @since 0.3.28-instance CoArbitrary P.ByteArray where- coarbitrary ba = coarbitrary (byteArrayToList ba)---- | @since 0.3.28-instance Function P.ByteArray where- function = functionMap byteArrayToList byteArrayFromList--byteArrayFromList :: [Word8] -> P.ByteArray-byteArrayFromList = P.byteArrayFromList--byteArrayToList :: P.ByteArray -> [Word8]-byteArrayToList = P.foldrByteArray (:) []
src/Test/QuickCheck/Instances/Semigroup.hs view
@@ -1,126 +1,2 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Semigroup () where--import Prelude ()-import Test.QuickCheck.Instances.CustomPrelude--import Control.Applicative (liftA2)-import Data.List.NonEmpty (NonEmpty (..), nonEmpty)-import Data.Maybe (mapMaybe)--import Test.QuickCheck--import qualified Data.Semigroup as Semi------------------------------------------------------------------------------------ semigroups----------------------------------------------------------------------------------instance Arbitrary1 NonEmpty where- liftArbitrary arb = liftA2 (:|) arb (liftArbitrary arb)- liftShrink shr (x :| xs) = mapMaybe nonEmpty . liftShrink shr $ x : xs--instance Arbitrary a => Arbitrary (NonEmpty a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (NonEmpty a) where- coarbitrary (x :| xs) = coarbitrary (x, xs)--instance Function a => Function (NonEmpty a) where- function = functionMap g h- where- g (x :| xs) = (x, xs)- h (x, xs) = x :| xs---instance Arbitrary1 Semi.Min where- liftArbitrary arb = Semi.Min <$> arb- liftShrink shr = map Semi.Min . shr . Semi.getMin--instance Arbitrary a => Arbitrary (Semi.Min a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (Semi.Min a) where- coarbitrary = coarbitrary . Semi.getMin--instance Function a => Function (Semi.Min a) where- function = functionMap Semi.getMin Semi.Min---instance Arbitrary1 Semi.Max where- liftArbitrary arb = Semi.Max <$> arb- liftShrink shr = map Semi.Max . shr . Semi.getMax--instance Arbitrary a => Arbitrary (Semi.Max a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (Semi.Max a) where- coarbitrary = coarbitrary . Semi.getMax--instance Function a => Function (Semi.Max a) where- function = functionMap Semi.getMax Semi.Max---instance Arbitrary1 Semi.First where- liftArbitrary arb = Semi.First <$> arb- liftShrink shr = map Semi.First . shr . Semi.getFirst--instance Arbitrary a => Arbitrary (Semi.First a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (Semi.First a) where- coarbitrary = coarbitrary . Semi.getFirst--instance Function a => Function (Semi.First a) where- function = functionMap Semi.getFirst Semi.First---instance Arbitrary1 Semi.Last where- liftArbitrary arb = Semi.Last <$> arb- liftShrink shr = map Semi.Last . shr . Semi.getLast--instance Arbitrary a => Arbitrary (Semi.Last a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (Semi.Last a) where- coarbitrary = coarbitrary . Semi.getLast--instance Function a => Function (Semi.Last a) where- function = functionMap Semi.getLast Semi.Last---instance Arbitrary1 Semi.WrappedMonoid where- liftArbitrary arb = Semi.WrapMonoid <$> arb- liftShrink shr = map Semi.WrapMonoid . shr . Semi.unwrapMonoid--instance Arbitrary a => Arbitrary (Semi.WrappedMonoid a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (Semi.WrappedMonoid a) where- coarbitrary = coarbitrary . Semi.unwrapMonoid--instance Function a => Function (Semi.WrappedMonoid a) where- function = functionMap Semi.unwrapMonoid Semi.WrapMonoid--#if !(MIN_VERSION_base(4,16,0))-instance Arbitrary1 Semi.Option where- liftArbitrary arb = Semi.Option <$> liftArbitrary arb- liftShrink shr = map Semi.Option . liftShrink shr . Semi.getOption--instance Arbitrary a => Arbitrary (Semi.Option a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (Semi.Option a) where- coarbitrary = coarbitrary . Semi.getOption--instance Function a => Function (Semi.Option a) where- function = functionMap Semi.getOption Semi.Option-#endif
src/Test/QuickCheck/Instances/Solo.hs view
@@ -1,23 +1,2 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Solo () where--import Prelude ()-import Test.QuickCheck.Instances.CustomPrelude--import Data.Tuple.Solo (Solo (MkSolo), getSolo)--import Test.QuickCheck--instance Arbitrary1 Solo where- liftArbitrary = fmap MkSolo- liftShrink shr = map MkSolo . shr . getSolo--instance Arbitrary a => Arbitrary (Solo a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (Solo a) where- coarbitrary = coarbitrary . getSolo--instance Function a => Function (Solo a) where- function = functionMap getSolo MkSolo
test/Tests.hs view
@@ -1,6 +1,7 @@ module Main (main) where import Data.Proxy (Proxy (..))+import Numeric.Natural (Natural) import Test.QuickCheck import Test.QuickCheck.Instances () @@ -21,6 +22,7 @@ main :: IO () main = do+ quickCheck $ eqReflexive (Proxy :: Proxy Natural) quickCheck $ eqReflexive (Proxy :: Proxy Int) quickCheck $ eqReflexive (Proxy :: Proxy (Tree.Tree Int)) quickCheck $ eqReflexive (Proxy :: Proxy UUID)