these 0.7.3 → 0.7.4
raw patch · 4 files changed
+42/−43 lines, 4 filesdep ~QuickCheckdep ~aesondep ~base
Dependency ranges changed: QuickCheck, aeson, base, bifunctors, binary, keys, profunctors, quickcheck-instances, semigroupoids, tasty, tasty-quickcheck, transformers-compat, unordered-containers
Files
- CHANGELOG.md +5/−0
- Data/These.hs +19/−9
- test/Tests.hs +0/−23
- these.cabal +18/−11
CHANGELOG.md view
@@ -1,3 +1,8 @@+# 0.7.4++- QuickCheck-2.10 support: Arbitrary1/2 instances+- GHC-8.2 support+ # 0.7.3 - Add `salign :: (Align f, Semigroup a) => f a -> f a -> f a`
Data/These.hs view
@@ -66,7 +66,7 @@ import Control.DeepSeq (NFData (..)) import Data.Aeson (FromJSON (..), ToJSON (..), (.=)) import Data.Binary (Binary (..))-import Test.QuickCheck (Arbitrary (..), CoArbitrary (..), oneof)+import Test.QuickCheck (Arbitrary (..), Arbitrary1 (..), Arbitrary2 (..), CoArbitrary (..), oneof, arbitrary1, shrink1) import Test.QuickCheck.Function (Function (..), functionMap) import qualified Data.HashMap.Strict as HM@@ -362,15 +362,25 @@ p _ = fail "Expected object with 'This' and 'That' keys only" #endif +instance Arbitrary2 These where+ liftArbitrary2 arbA arbB = oneof+ [ This <$> arbA+ , That <$> arbB+ , These <$> arbA <*> arbB+ ]++ liftShrink2 shrA _shrB (This x) = This <$> shrA x+ liftShrink2 _shrA shrB (That y) = That <$> shrB y+ liftShrink2 shrA shrB (These x y) =+ [This x, That y] ++ [These x' y' | (x', y') <- liftShrink2 shrA shrB (x, y)]++instance (Arbitrary a) => Arbitrary1 (These a) where+ liftArbitrary = liftArbitrary2 arbitrary+ liftShrink = liftShrink2 shrink+ instance (Arbitrary a, Arbitrary b) => Arbitrary (These a b) where- arbitrary = oneof [ This <$> arbitrary- , That <$> arbitrary- , These <$> arbitrary <*> arbitrary- ]- shrink (This x) = This <$> shrink x- shrink (That y) = That <$> shrink y- shrink (These x y) = [This x, That y] ++- [These x' y' | (x', y') <- shrink (x, y)]+ arbitrary = arbitrary1+ shrink = shrink1 instance (Function a, Function b) => Function (These a b) where function = functionMap g f
test/Tests.hs view
@@ -35,7 +35,6 @@ import qualified Data.Aeson as Aeson import qualified Data.Binary as Binary-import qualified Data.Set as Set -- For old GHC to work data Proxy (a :: * -> *) = Proxy@@ -206,28 +205,6 @@ where lhs = crosswalk f x rhs = sequenceL . fmap f $ x------------------------------------------------------------------------------------ Orphan instances----------------------------------------------------------------------------------instance (Arbitrary a, Arbitrary (f a), Arbitrary (g a))- => Arbitrary (P.Product f g a) where- arbitrary = P.Pair <$> arbitrary <*> arbitrary- shrink (P.Pair x y) = [P.Pair x' y' | (x', y') <- shrink (x, y)]---#if !MIN_VERSION_quickcheck_instances(0,3,12)-instance Arbitrary a => Arbitrary (V.Vector a) where- arbitrary = V.fromList <$> arbitrary- shrink = fmap V.fromList . shrink . V.toList-#endif--#if !MIN_VERSION_QuickCheck(2,9,0)-instance Arbitrary a => Arbitrary (ZipList a) where- arbitrary = ZipList <$> arbitrary- shrink = fmap ZipList . shrink . getZipList-#endif ------------------------------------------------------------------------------- -- aeson
these.cabal view
@@ -1,5 +1,5 @@ Name: these-Version: 0.7.3+Version: 0.7.4 Synopsis: An either-or-both data type & a generalized 'zip with padding' typeclass Homepage: https://github.com/isomorphism/these License: BSD3@@ -22,6 +22,13 @@ . Also included is @ChronicleT@, a monad transformer based on the Monad instance for @These a@, along with the usual monad transformer bells and whistles.+tested-with:+ GHC==7.4.2,+ GHC==7.6.3,+ GHC==7.8.4,+ GHC==7.10.3,+ GHC==8.0.2,+ GHC==8.2.1 source-repository head type: git@@ -35,10 +42,10 @@ Control.Monad.Chronicle.Class, Control.Monad.Trans.Chronicle - Build-depends: base >= 4.4 && < 4.10,- aeson >= 0.7.0.4 && < 1.1,+ Build-depends: base >= 4.4 && < 4.11,+ aeson >= 0.7.0.4 && < 1.3, bifunctors >= 0.1 && < 5.5,- binary >= 0.5.0.2 && < 0.9,+ binary >= 0.5.0.2 && < 0.10, containers >= 0.4 && < 0.6, data-default-class >= 0.0 && < 0.2, deepseq >= 1.3.0.0 && < 1.5,@@ -46,13 +53,13 @@ keys >= 3.10 && < 3.12, mtl >= 2 && < 2.3, profunctors >= 3 && < 5.3,- QuickCheck >= 2.8 && < 2.9.3,- semigroupoids >= 1.0 && < 5.2,+ QuickCheck >= 2.10 && < 2.11,+ semigroupoids >= 1.0 && < 5.3, transformers >= 0.2 && < 0.6, transformers-compat >= 0.2 && < 0.6, unordered-containers >= 0.2 && < 0.3,- vector >= 0.4 && < 0.12,- vector-instances >= 3.3.1 && < 3.4+ vector >= 0.4 && < 0.13,+ vector-instances >= 3.3.1 && < 3.5 if impl(ghc <7.5) build-depends: ghc-prim @@ -69,9 +76,9 @@ ghc-options: -Wall build-depends: these, base >= 4.5,- quickcheck-instances >= 0.3.6 && < 0.3.13,- tasty >= 0.10 && < 0.12,- tasty-quickcheck >= 0.8 && < 0.9,+ quickcheck-instances >= 0.3.15 && < 0.3.16,+ tasty >= 0.10 && < 0.12,+ tasty-quickcheck >= 0.8 && < 0.10, aeson, bifunctors, binary,