quickcheck-instances 0.3.30 → 0.3.31
raw patch · 26 files changed
+54/−235 lines, 26 filesdep −bytestring-builderdep −natsdep −semigroupsdep ~OneTupledep ~QuickCheckdep ~array
Dependencies removed: bytestring-builder, nats, semigroups, time, transformers-compat, void
Dependency ranges changed: OneTuple, QuickCheck, array, base, bytestring, case-insensitive, containers, hashable, integer-logarithms, primitive, scientific, splitmix, strict, tagged, text-short, these, transformers, unordered-containers, uuid-types, vector
Files
- CHANGES +4/−0
- quickcheck-instances.cabal +43/−70
- src/Test/QuickCheck/Instances.hs +1/−5
- src/Test/QuickCheck/Instances/Array.hs +0/−2
- src/Test/QuickCheck/Instances/Array/Byte.hs +0/−32
- src/Test/QuickCheck/Instances/ByteString.hs +0/−2
- src/Test/QuickCheck/Instances/CaseInsensitive.hs +0/−2
- src/Test/QuickCheck/Instances/Containers.hs +0/−57
- src/Test/QuickCheck/Instances/Hashable.hs +0/−12
- src/Test/QuickCheck/Instances/Natural.hs +0/−2
- src/Test/QuickCheck/Instances/OldTime.hs +0/−2
- src/Test/QuickCheck/Instances/Primitive.hs +0/−2
- src/Test/QuickCheck/Instances/Scientific.hs +0/−2
- src/Test/QuickCheck/Instances/Semigroup.hs +1/−2
- src/Test/QuickCheck/Instances/Solo.hs +0/−6
- src/Test/QuickCheck/Instances/Strict.hs +0/−2
- src/Test/QuickCheck/Instances/Tagged.hs +0/−4
- src/Test/QuickCheck/Instances/Text.hs +0/−2
- src/Test/QuickCheck/Instances/Text/Short.hs +0/−2
- src/Test/QuickCheck/Instances/These.hs +0/−2
- src/Test/QuickCheck/Instances/Time.hs +0/−6
- src/Test/QuickCheck/Instances/Transformer.hs +0/−2
- src/Test/QuickCheck/Instances/UUID.hs +0/−2
- src/Test/QuickCheck/Instances/UnorderedContainers.hs +0/−2
- src/Test/QuickCheck/Instances/Vector.hs +0/−3
- test/Tests.hs +5/−10
CHANGES view
@@ -1,3 +1,7 @@+0.3.31++* Support GHC-8.6.5...GHC-9.10.1+ 0.3.30 * Improve Arbitrary UUID instance
quickcheck-instances.cabal view
@@ -1,5 +1,6 @@+cabal-version: 2.2 name: quickcheck-instances-version: 0.3.30+version: 0.3.31 synopsis: Common quickcheck instances description: QuickCheck instances.@@ -13,7 +14,7 @@ impose these instances on down-stream consumers of your code. -license: BSD3+license: BSD-3-Clause license-file: LICENSE author: Antoine Latter <aslatter@gmail.com>, Oleg Grenrus <oleg.grenrus@iki.fi>@@ -25,35 +26,29 @@ category: Testing build-type: Simple extra-source-files: CHANGES-cabal-version: >=1.10 tested-with:- GHC ==7.4.2- || ==7.6.3- || ==7.8.4- || ==7.10.3- || ==8.0.2- || ==8.2.2- || ==8.4.4- || ==8.6.5+ GHC ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.8- || ==9.4.7- || ==9.6.3- || ==9.8.1+ || ==9.4.8+ || ==9.6.5+ || ==9.8.2+ || ==9.10.1 source-repository head type: git location: https://github.com/haskellari/qc-instances.git -flag bytestring-builder- description: Use bytestring-builder (with old bytestring)- default: False- manual: False- library- default-language: Haskell2010+ default-language: Haskell2010+ default-extensions:+ BangPatterns+ FlexibleContexts+ FlexibleInstances+ TypeOperators+ exposed-modules: Test.QuickCheck.Instances Test.QuickCheck.Instances.Array@@ -72,6 +67,7 @@ Test.QuickCheck.Instances.Strict Test.QuickCheck.Instances.Tagged Test.QuickCheck.Instances.Text+ Test.QuickCheck.Instances.Text.Short Test.QuickCheck.Instances.These Test.QuickCheck.Instances.Time Test.QuickCheck.Instances.Transformer@@ -80,63 +76,40 @@ Test.QuickCheck.Instances.Vector Test.QuickCheck.Instances.Void - other-modules: Test.QuickCheck.Instances.CustomPrelude- hs-source-dirs: src+ other-modules: Test.QuickCheck.Instances.CustomPrelude+ hs-source-dirs: src build-depends:- base >=4.5 && <4.20- , QuickCheck >=2.14.1 && <2.14.4- , splitmix >=0.0.2 && <0.2+ , base >=4.12.0.0 && <4.21+ , QuickCheck >=2.14.2 && <2.15.0+ , splitmix >=0.1.0.5 && <0.2 build-depends:- array >=0.4.0.0 && <0.6- , bytestring >=0.9.2.1 && <0.13- , case-insensitive >=1.2.0.4 && <1.3- , containers >=0.4.2.1 && <0.7+ , 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.2.7.0 && <1.5- , integer-logarithms >=1.0.3 && <1.1+ , hashable >=1.4.4.0 && <1.5+ , integer-logarithms >=1.0.3.1 && <1.1 , old-time >=1.1.0.0 && <1.2- , OneTuple >=0.3 && <0.5- , primitive >=0.6.4.0 && <0.9- , scientific >=0.3.6.2 && <0.4- , strict >=0.4 && <0.6- , tagged >=0.8.6 && <0.9- , text >=1.2.3.0 && <1.3 || >=2.0 && <2.2- , these >=1.1.1.1 && <1.3+ , 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.3.0.0 && <0.7- , transformers-compat >=0.6.5 && <0.8- , unordered-containers >=0.2.2.0 && <0.3- , uuid-types >=1.0.4 && <1.1- , vector >=0.12.3.1 && <0.14-- -- version is irrelevant.- build-depends: time+ , transformers >=0.5.6.2 && <0.7+ , unordered-containers >=0.2.20 && <0.3+ , uuid-types >=1.0.6 && <1.1+ , vector >=0.13.1.0 && <0.14 - if impl(ghc >=8.0 && <9.4)+ if impl(ghc <9.4) build-depends: data-array-byte >=0.1.0.1 && <0.2 - if !impl(ghc >=8.0)- build-depends: semigroups >=0.18.5 && <0.21-- if !impl(ghc >=7.10)- build-depends:- nats >=1.1.2 && <1.2- , void >=0.7.2 && <0.8-- if flag(bytestring-builder)- build-depends:- bytestring <0.10.4.0- , bytestring-builder >=0.10.4 && <0.11-- else- build-depends: bytestring >=0.10.4.0-- if impl(ghc >=7.8)- exposed-modules: Test.QuickCheck.Instances.Text.Short- build-depends: text-short >=0.1.3 && <0.2-- ghc-options: -Wall+ ghc-options: -Wall test-suite self-test default-language: Haskell2010@@ -144,7 +117,7 @@ main-is: Tests.hs hs-source-dirs: test build-depends:- base+ , base , containers , primitive , QuickCheck@@ -161,7 +134,7 @@ main-is: ByteString.hs hs-source-dirs: bench build-depends:- base+ , base , bytestring , QuickCheck , quickcheck-instances
src/Test/QuickCheck/Instances.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-| Instances are provided for the types in the packages: @@ -59,6 +58,7 @@ import Test.QuickCheck.Instances.Strict () import Test.QuickCheck.Instances.Tagged () import Test.QuickCheck.Instances.Text ()+import Test.QuickCheck.Instances.Text.Short () import Test.QuickCheck.Instances.These () import Test.QuickCheck.Instances.Time () import Test.QuickCheck.Instances.Transformer ()@@ -66,7 +66,3 @@ import Test.QuickCheck.Instances.UUID () import Test.QuickCheck.Instances.Vector () import Test.QuickCheck.Instances.Void ()--#ifdef MIN_VERSION_text_short-import Test.QuickCheck.Instances.Text.Short ()-#endif
src/Test/QuickCheck/Instances/Array.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Array () where
src/Test/QuickCheck/Instances/Array/Byte.hs view
@@ -1,36 +1,4 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-}-{-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Array.Byte () where -#if !MIN_VERSION_primitive(0,8,0) && MIN_VERSION_base(4,9,0)- import Prelude ()-import Test.QuickCheck.Instances.CustomPrelude import Test.QuickCheck.Instances.Primitive ()--import Test.QuickCheck--import Data.Array.Byte (ByteArray (..))-import qualified Data.Primitive as P---- | @since 0.3.28-instance Arbitrary ByteArray where- arbitrary = fromP <$> arbitrary- shrink ba = fromP <$> shrink (toP ba)---- | @since 0.3.28-instance CoArbitrary ByteArray where- coarbitrary ba = coarbitrary (toP ba)---- | @since 0.3.28-instance Function ByteArray where- function = functionMap toP fromP--toP :: ByteArray -> P.ByteArray-toP (ByteArray ba) = P.ByteArray ba--fromP :: P.ByteArray -> ByteArray-fromP (P.ByteArray ba) = ByteArray ba--#endif
src/Test/QuickCheck/Instances/ByteString.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE BangPatterns #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.ByteString () where
src/Test/QuickCheck/Instances/CaseInsensitive.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.CaseInsensitive () where
src/Test/QuickCheck/Instances/Containers.hs view
@@ -1,58 +1,1 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-}-{-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Containers () where--#if !MIN_VERSION_QuickCheck(2,14,2)-import Prelude ()-import Test.QuickCheck.Instances.CustomPrelude--import Test.QuickCheck- (Arbitrary (..), Arbitrary1 (..), CoArbitrary (..), Function (..), Gen,- arbitrary1, chooseInt, functionMap, liftShrink2, shrink1, shuffle,- sized)--import qualified Data.Tree as Tree------------------------------------------------------------------------------------ containers----------------------------------------------------------------------------------instance Arbitrary1 Tree.Tree where- liftArbitrary arb = sized $ \n -> do- k <- chooseInt (0, n)- go k- where- go n = do -- n is the size of the trees.- value <- arb- pars <- arbPartition (n - 1) -- can go negative!- forest <- traverse go pars- return $ Tree.Node value forest-- arbPartition :: Int -> Gen [Int]- arbPartition k = case compare k 1 of- LT -> pure []- EQ -> pure [1]- GT -> do- first <- chooseInt (1, k)- rest <- arbPartition $ k - first- shuffle (first : rest)-- liftShrink shr = go- where- go (Tree.Node val forest) = forest ++- [ Tree.Node e fs- | (e, fs) <- liftShrink2 shr (liftShrink go) (val, forest)- ]--instance Arbitrary a => Arbitrary (Tree.Tree a) where- arbitrary = arbitrary1- shrink = shrink1--instance CoArbitrary a => CoArbitrary (Tree.Tree a) where- coarbitrary (Tree.Node val forest) =- coarbitrary val . coarbitrary forest--instance Function a => Function (Tree.Tree a) where- function = functionMap (\(Tree.Node x xs) -> (x,xs)) (uncurry Tree.Node)-#endif
src/Test/QuickCheck/Instances/Hashable.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Hashable () where @@ -7,11 +5,7 @@ import Test.QuickCheck.Instances.CustomPrelude import Data.Hashable (Hashable, Hashed, hashed)-#if MIN_VERSION_hashable(1,4,0) import Data.Hashable (hashedHash)-#else-import Data.Hashable (hash)-#endif import Test.QuickCheck @@ -19,14 +13,8 @@ -- hashable ------------------------------------------------------------------------------- -#if MIN_VERSION_hashable(1,2,5) instance (Hashable a, Arbitrary a) => Arbitrary (Hashed a) where arbitrary = hashed <$> arbitrary instance CoArbitrary (Hashed a) where-#if MIN_VERSION_hashable(1,4,0) coarbitrary x = coarbitrary (hashedHash x :: Int)-#else- coarbitrary x = coarbitrary (hash x :: Int)-#endif-#endif
src/Test/QuickCheck/Instances/Natural.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Natural () where
src/Test/QuickCheck/Instances/OldTime.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.OldTime () where
src/Test/QuickCheck/Instances/Primitive.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Primitive () where
src/Test/QuickCheck/Instances/Scientific.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Scientific () where
src/Test/QuickCheck/Instances/Semigroup.hs view
@@ -1,5 +1,4 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Semigroup () where
src/Test/QuickCheck/Instances/Solo.hs view
@@ -1,16 +1,10 @@-{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Solo () where import Prelude () import Test.QuickCheck.Instances.CustomPrelude -#if MIN_VERSION_OneTuple(0,4,0) import Data.Tuple.Solo (Solo (MkSolo), getSolo)-#else-import Data.Tuple.Solo (Solo (Solo), getSolo)-#define MkSolo Solo-#endif import Test.QuickCheck
src/Test/QuickCheck/Instances/Strict.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Strict () where
src/Test/QuickCheck/Instances/Tagged.hs view
@@ -1,8 +1,4 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-}-#if __GLASGOW_HASKELL__ >= 706 {-# LANGUAGE PolyKinds #-}-#endif {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Tagged () where
src/Test/QuickCheck/Instances/Text.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Text () where
src/Test/QuickCheck/Instances/Text/Short.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Text.Short () where
src/Test/QuickCheck/Instances/These.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.These () where
src/Test/QuickCheck/Instances/Time.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Time () where @@ -39,11 +37,7 @@ instance Arbitrary Time.DiffTime where arbitrary = arbitrarySizedFractional-#if MIN_VERSION_time(1,3,0) shrink = shrinkRealFrac-#else- shrink = (fromRational <$>) . shrink . toRational-#endif instance CoArbitrary Time.DiffTime where coarbitrary = coarbitraryReal
src/Test/QuickCheck/Instances/Transformer.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Transformer () where
src/Test/QuickCheck/Instances/UUID.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.UUID () where
src/Test/QuickCheck/Instances/UnorderedContainers.hs view
@@ -1,5 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.UnorderedContainers () where
src/Test/QuickCheck/Instances/Vector.hs view
@@ -1,6 +1,3 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE FlexibleContexts #-}-{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Vector () where
test/Tests.hs view
@@ -1,18 +1,15 @@-{-# LANGUAGE CPP #-} module Main (main) where -import Data.Proxy (Proxy (..))+import Data.Proxy (Proxy (..)) import Test.QuickCheck import Test.QuickCheck.Instances () -import qualified Data.Tree as Tree-import qualified Data.Primitive as Prim+import qualified Data.Array.Byte as AB+import qualified Data.Primitive as Prim+import qualified Data.Tree as Tree -import Data.UUID.Types (UUID)+import Data.UUID.Types (UUID) -#if MIN_VERSION_base(4,9,0)-import qualified Data.Array.Byte as AB-#endif -- | Example law: == (and thus ===) should be reflexive. eqReflexive@@ -28,6 +25,4 @@ quickCheck $ eqReflexive (Proxy :: Proxy (Tree.Tree Int)) quickCheck $ eqReflexive (Proxy :: Proxy UUID) quickCheck $ eqReflexive (Proxy :: Proxy Prim.ByteArray)-#if MIN_VERSION_base(4,9,0) quickCheck $ eqReflexive (Proxy :: Proxy AB.ByteArray)-#endif