packages feed

quickcheck-instances 0.3.25.2 → 0.3.26

raw patch · 7 files changed

+93/−9 lines, 7 filesdep +OneTupledep +text-shortdep ~basedep ~bytestring

Dependencies added: OneTuple, text-short

Dependency ranges changed: base, bytestring

Files

CHANGES view
@@ -1,3 +1,10 @@+0.3.26++* Support base-4.16 / GHC-9.2+* Add instances for `text-short`'s `ShortText` type+* Add instances for `Solo`+* Fix bug in `CoArbitrary (Hashed a)` instance+ 0.3.25.2  * Fix bug in QuarterOfYear instance
quickcheck-instances.cabal view
@@ -1,5 +1,5 @@ name:               quickcheck-instances-version:            0.3.25.2+version:            0.3.26 synopsis:           Common quickcheck instances description:   QuickCheck instances.@@ -39,7 +39,9 @@    || ==8.4.4    || ==8.6.5    || ==8.8.4-   || ==8.10.3+   || ==8.10.4+   || ==9.0.1+   || ==9.2.1  source-repository head   type:     git@@ -64,6 +66,7 @@     Test.QuickCheck.Instances.OldTime     Test.QuickCheck.Instances.Scientific     Test.QuickCheck.Instances.Semigroup+    Test.QuickCheck.Instances.Solo     Test.QuickCheck.Instances.Strict     Test.QuickCheck.Instances.Tagged     Test.QuickCheck.Instances.Text@@ -78,7 +81,7 @@   other-modules:    Test.QuickCheck.Instances.CustomPrelude   hs-source-dirs:   src   build-depends:-      base        >=4.5    && <4.15+      base        >=4.5    && <4.17     , QuickCheck  >=2.14.1 && <2.14.3     , splitmix    >=0.0.2  && <0.2 @@ -91,14 +94,15 @@     , hashable              >=1.2.7.0 && <1.4     , integer-logarithms    >=1.0.3   && <1.1     , old-time              >=1.1.0.0 && <1.2+    , OneTuple              >=0.3     && <0.4     , scientific            >=0.3.6.2 && <0.4     , strict                >=0.4     && <0.5     , tagged                >=0.8.6   && <0.9     , text                  >=1.2.3.0 && <1.3     , these                 >=1.1.1.1 && <1.2     , time-compat           >=1.9.4   && <1.10-    , transformers          >=0.3.0.0 && <0.6-    , transformers-compat   >=0.6.5   && <0.7+    , 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.3   && <1.1     , vector                >=0.9     && <0.13@@ -116,11 +120,15 @@    if flag(bytestring-builder)     build-depends:-        bytestring          >=0      && <0.10.4.0+        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 
src/Test/QuickCheck/Instances.hs view
@@ -12,14 +12,28 @@   * containers + * data-fix++ * OneTuple+  * old-time + * strict+  * text + * text-short++ * these+  * time   * unordered-containers + * uuid++ * vector+ Since all of these instances are provided as orphans, I recommend that you do not use this library within another library module, so that you don't impose these instances on down-stream consumers of your code.@@ -40,6 +54,7 @@ import Test.QuickCheck.Instances.OldTime () import Test.QuickCheck.Instances.Scientific () import Test.QuickCheck.Instances.Semigroup ()+import Test.QuickCheck.Instances.Solo () import Test.QuickCheck.Instances.Strict () import Test.QuickCheck.Instances.Tagged () import Test.QuickCheck.Instances.Text ()@@ -50,3 +65,7 @@ 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/Hashable.hs view
@@ -6,7 +6,7 @@ import Prelude () import Test.QuickCheck.Instances.CustomPrelude -import Data.Hashable (Hashable, Hashed, hashed)+import Data.Hashable (Hashable, Hashed, hash, hashed)  import Test.QuickCheck @@ -19,5 +19,5 @@     arbitrary = hashed <$> arbitrary  instance CoArbitrary (Hashed a) where-    coarbitrary x = coarbitrary (hashed x)+    coarbitrary x = coarbitrary (hash x :: Int) #endif
src/Test/QuickCheck/Instances/Semigroup.hs view
@@ -110,7 +110,7 @@ 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@@ -124,3 +124,4 @@  instance Function a => Function (Semi.Option a) where     function = functionMap Semi.getOption Semi.Option+#endif
+ src/Test/QuickCheck/Instances/Solo.hs view
@@ -0,0 +1,24 @@+{-# LANGUAGE CPP              #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Test.QuickCheck.Instances.Solo () where++import Prelude ()+import Test.QuickCheck.Instances.CustomPrelude++import Data.Tuple.Solo (Solo (Solo), getSolo)++import Test.QuickCheck++instance Arbitrary1 Solo where+  liftArbitrary = fmap Solo+  liftShrink shr = map Solo . 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 Solo
+ src/Test/QuickCheck/Instances/Text/Short.hs view
@@ -0,0 +1,25 @@+{-# LANGUAGE CPP              #-}+{-# LANGUAGE FlexibleContexts #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}+module Test.QuickCheck.Instances.Text.Short () where++import Prelude ()+import Test.QuickCheck.Instances.CustomPrelude++import Test.QuickCheck++import qualified Data.Text.Short as T++-------------------------------------------------------------------------------+-- text+-------------------------------------------------------------------------------++instance Arbitrary T.ShortText where+    arbitrary = T.pack <$> arbitrary+    shrink xs = T.pack <$> shrink (T.unpack xs)++instance CoArbitrary T.ShortText where+    coarbitrary = coarbitrary . T.unpack++instance Function T.ShortText where+    function = functionMap T.unpack T.pack