quickcheck-classes 0.4.0 → 0.4.1
raw patch · 2 files changed
+24/−9 lines, 2 filesdep ~transformers
Dependency ranges changed: transformers
Files
quickcheck-classes.cabal view
@@ -1,5 +1,5 @@ name: quickcheck-classes-version: 0.4.0+version: 0.4.1 synopsis: QuickCheck common typeclasses description: This library provides quickcheck properties to@@ -30,8 +30,8 @@ base >= 4.5 && < 5 , bifunctors , QuickCheck >= 2.9- , transformers- , primitive >= 0.6.1+ , transformers >= 0.4 && < 0.6+ , primitive >= 0.6.1 && < 0.7 , aeson , containers , semigroups
src/Test/QuickCheck/Classes.hs view
@@ -61,11 +61,13 @@ , altLaws , alternativeLaws , applicativeLaws- , bifunctorLaws , foldableLaws , functorLaws , monadLaws+#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)+ , bifunctorLaws #endif+#endif -- * Types , Laws(..) ) where@@ -843,6 +845,10 @@ -- @'second' 'id' ≡ 'id'@ -- [/Bifunctor Composition/] -- @'bimap' f g ≡ 'first' f . 'second' g@ +--+-- /Note/: This property test is only available when this package is built with+-- @base-4.9+@ or @transformers-0.5+@.+#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0) bifunctorLaws :: (Bifunctor f, Eq2 f, Show2 f, Arbitrary2 f) => proxy f -> Laws bifunctorLaws p = Laws "Bifunctor" [ ("Identity", bifunctorIdentity p)@@ -850,6 +856,7 @@ , ("Second Identity", bifunctorSecondIdentity p) , ("Bifunctor Composition", bifunctorComposition p) ]+#endif -- | Tests the following 'Foldable' properties: --@@ -1002,9 +1009,6 @@ instance (Eq1 f, Eq a) => Eq (Apply f a) where Apply a == Apply b = eq1 a b -instance (Eq2 f, Eq a, Eq b) => Eq (Apply2 f a b) where- Apply2 a == Apply2 b = eq2 a b- instance (Applicative f, Monoid a) => Semigroup (Apply f a) where Apply x <> Apply y = Apply $ liftA2 mappend x y @@ -1012,8 +1016,13 @@ mempty = Apply $ pure mempty mappend = (SG.<>) +#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0)+instance (Eq2 f, Eq a, Eq b) => Eq (Apply2 f a b) where+ Apply2 a == Apply2 b = eq2 a b+ instance (Show2 f, Show a, Show b) => Show (Apply2 f a b) where showsPrec p = showsPrec2 p . getApply2+#endif instance (Arbitrary2 f, Arbitrary a, Arbitrary b) => Arbitrary (Apply2 f a b) where arbitrary = fmap Apply2 arbitrary2@@ -1025,6 +1034,10 @@ , _linearEquationConstant :: Integer } deriving (Eq) +instance Show LinearEquation where+ showsPrec = showLinear+ showList = showLinearList+ data LinearEquationM m = LinearEquationM (m LinearEquation) (m LinearEquation) runLinearEquation :: Integer -> LinearEquation -> Integer@@ -1050,9 +1063,9 @@ instance Show1 m => Show (LinearEquationM m) where show (LinearEquationM a b) = (\f -> f "") $ showString "\\x -> if odd x then "- . liftShowsPrec showLinear showLinearList 0 a+ . showsPrec1 0 a . showString " else "- . liftShowsPrec showLinear showLinearList 0 b+ . showsPrec1 0 b instance Arbitrary1 m => Arbitrary (LinearEquationM m) where arbitrary = liftA2 LinearEquationM arbitrary1 arbitrary1@@ -1198,6 +1211,7 @@ let f = fmap runEquation f' in eq1 (ap f x) (f <*> x) +#if MIN_VERSION_base(4,9,0) || MIN_VERSION_transformers(0,5,0) bifunctorIdentity :: forall proxy f. (Bifunctor f, Eq2 f, Show2 f, Arbitrary2 f) => proxy f -> Property bifunctorIdentity _ = property $ \(Apply2 (x :: f Integer Integer)) -> eq2 (bimap id id x) x @@ -1212,6 +1226,7 @@ (Bifunctor f, Eq2 f, Show2 f, Arbitrary2 f) => proxy f -> Property bifunctorComposition _ = property $ \(Apply2 (z :: f Integer Integer)) -> eq2 (bimap id id z) ((first id . second id) z)+#endif #endif