packages feed

quickcheck-instances 0.3.29.1 → 0.3.30

raw patch · 3 files changed

+46/−17 lines, 3 filesdep ~basedep ~bytestringdep ~primitive

Dependency ranges changed: base, bytestring, primitive, text, uuid-types

Files

CHANGES view
@@ -1,3 +1,27 @@+0.3.30++* Improve Arbitrary UUID instance++  Previously "small" UUIDs were generated, e.g.++  ```+  00000001-0000-0001-0000-000000000001+  00000002-0000-0000-0000-000200000002+  00000004-0000-0004-0000-000400000001+  00000005-0000-0000-0000-000500000007+  00000001-0000-000d-0000-00050000000e+  ```++  but now they are uniformly random++  ```+  c4683284-bfe3-224b-29a6-1e7f11ceef65+  7bf6564d-5dcf-3e37-b13d-867085f54dae+  5b006243-0a70-9321-6594-20dde3d72112+  2d8ed56e-ed20-7258-7c1f-b46fa9b87946+  f1503184-9d3c-aacd-e9a7-36c655b70f41+  ```+ 0.3.29.1  * Support `OneTuple-0.4`
quickcheck-instances.cabal view
@@ -1,5 +1,5 @@ name:               quickcheck-instances-version:            0.3.29.1+version:            0.3.30 synopsis:           Common quickcheck instances description:   QuickCheck instances.@@ -38,9 +38,10 @@    || ==8.8.4    || ==8.10.7    || ==9.0.2-   || ==9.2.7-   || ==9.4.4-   || ==9.6.1+   || ==9.2.8+   || ==9.4.7+   || ==9.6.3+   || ==9.8.1  source-repository head   type:     git@@ -82,13 +83,13 @@   other-modules:    Test.QuickCheck.Instances.CustomPrelude   hs-source-dirs:   src   build-depends:-      base        >=4.5    && <4.18-    , QuickCheck  >=2.14.1 && <2.14.3+      base        >=4.5    && <4.20+    , QuickCheck  >=2.14.1 && <2.14.4     , splitmix    >=0.0.2  && <0.2    build-depends:       array                 >=0.4.0.0  && <0.6-    , bytestring            >=0.9.2.1  && <0.12+    , bytestring            >=0.9.2.1  && <0.13     , case-insensitive      >=1.2.0.4  && <1.3     , containers            >=0.4.2.1  && <0.7     , data-fix              >=0.3      && <0.4@@ -98,15 +99,15 @@     , OneTuple              >=0.3      && <0.5     , primitive             >=0.6.4.0  && <0.9     , scientific            >=0.3.6.2  && <0.4-    , strict                >=0.4      && <0.5+    , strict                >=0.4      && <0.6     , tagged                >=0.8.6    && <0.9-    , text                  >=1.2.3.0  && <1.3 || >=2.0 && <2.1-    , these                 >=1.1.1.1  && <1.2+    , text                  >=1.2.3.0  && <1.3 || >=2.0 && <2.2+    , these                 >=1.1.1.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.3    && <1.1+    , uuid-types            >=1.0.4    && <1.1     , vector                >=0.12.3.1 && <0.14    -- version is irrelevant.
src/Test/QuickCheck/Instances/UUID.hs view
@@ -6,9 +6,10 @@ import Prelude () import Test.QuickCheck.Instances.CustomPrelude -import Data.Word (Word32)+import Data.Word (Word64)  import Test.QuickCheck+import Test.QuickCheck.Gen (chooseUpTo)  import qualified Data.UUID.Types as UUID @@ -16,16 +17,19 @@ -- uuid ------------------------------------------------------------------------------- -uuidFromWords :: (Word32, Word32, Word32, Word32) -> UUID.UUID-uuidFromWords (a,b,c,d) = UUID.fromWords a b c d+uuidFromWords64 :: (Word64, Word64) -> UUID.UUID+uuidFromWords64 (a,b) = UUID.fromWords64 a b +uniformWord64 :: Gen Word64+uniformWord64 = chooseUpTo maxBound+ -- | Uniform distribution. instance Arbitrary UUID.UUID where-    arbitrary = uuidFromWords <$> arbitrary-    shrink = map uuidFromWords . shrink . UUID.toWords+    arbitrary = UUID.fromWords64 <$> uniformWord64 <*> uniformWord64+    shrink = map uuidFromWords64 . shrink . UUID.toWords64  instance CoArbitrary UUID.UUID where     coarbitrary = coarbitrary . UUID.toWords  instance Function UUID.UUID where-    function = functionMap UUID.toWords uuidFromWords+    function = functionMap UUID.toWords64 uuidFromWords64