quickcheck-higherorder 0.1.0.0 → 0.1.0.1
raw patch · 3 files changed
+48/−14 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Test.QuickCheck.HigherOrder: data (:->) a r
+ Test.QuickCheck.HigherOrder: data a :-> r
- Test.QuickCheck.HigherOrder: applyFun :: () => (a :-> r) -> a -> r
+ Test.QuickCheck.HigherOrder: applyFun :: (a :-> r) -> a -> r
- Test.QuickCheck.HigherOrder: coarbitraryGeneric :: (Generic a, GCoArbitrary gen a) => Co gen a r
+ Test.QuickCheck.HigherOrder: coarbitraryGeneric :: forall a r gen. (Generic a, GCoArbitrary gen a) => Co gen a r
Files
- CHANGELOG.md +7/−0
- README.md +33/−6
- quickcheck-higherorder.cabal +8/−8
+ CHANGELOG.md view
@@ -0,0 +1,7 @@+# 0.1.0.1++- Polish documentation (README and cabal metadata)++# 0.1.0.0++- Create quickcheck-higherorder
README.md view
@@ -1,7 +1,35 @@-# Higher-order QuickCheck+# Higher-order QuickCheck [](https://hackage.haskell.org/package/quickcheck-higherorder)  A QuickCheck extension for properties of higher-order values. +## Examples++Higher-order properties are properties which may:++1. quantify over functions;+2. state equalities between functions.++Some examples:++```haskell+fmap_dot :: forall a b c. (b -> c) -> (a -> b) -> Equation (Maybe a -> Maybe c)+fmap_dot g f x = (fmap g . fmap f) :=: fmap (f . g)++callCC_bind :: forall r a. Cont r a -> Equation (Cont r a)+callCC_bind m = callCC ((>>=) m) :=: m+```++*quickcheck-higherorder* makes it easy to define and test such properties.++```haskell+main :: IO ()+main = do+ quickCheck' (fmap_dot @Int @Int @Int)+ quickCheck' (callCC_bind @Int @Int)+```++(Additional setup is required for the `callCC` example.)+ ## Summary QuickCheck has a cute trick to implicitly convert functions@@ -49,7 +77,7 @@ ``` The simpler expression `quickCheck prop_bool` would not typecheck-because `Bool -> Bool` is not an instance of `Arbitrary` nor `Show`.+because `Bool -> Bool` is not an instance of `Show`. With "higher-order" QuickCheck, that wrapping performed by `Fn` is instead taken care of by the `Constructible` class, so we can write simply:@@ -118,8 +146,7 @@ `Property` introduces some unexpected complexity in the types. For example, try generalizing the property `prop_bool` above to-arbitrary types instead of `Bool`-(so it's no longer valid as a property, of course).+arbitrary types instead of `Bool`. Since we use testable equality of functions `a -> a`, we incur constraints that the domain must be `Constructible`, and the codomain itself must have testable equality.@@ -129,7 +156,7 @@ prop_fun f = (f . f . f) =? f ``` -In my opinion, this type tells both too much and too little.+This type tells us both too much and too little. Too much, because the constraints leak details about the very specific way in which the comparison is performed. Too little, because a `Property` can do a lot of things besides testing the equality of two values;@@ -153,7 +180,7 @@ It is equipped with a `Testable` instance that will require a `TestEq` constraint indirectly at call sites only. -## Example+## Full example ```haskell import Test.QuickCheck (quickCheck)
quickcheck-higherorder.cabal view
@@ -1,16 +1,16 @@ name: quickcheck-higherorder-version: 0.1.0.0+version: 0.1.0.1 synopsis: QuickCheck extension for higher-order properties description: Enhancements for property-based testing of higher-order properties. . * Associate types to their representations with the- 'Test.QuickCheck.HigherOrder.Constructible' class.- * 'Test.QuickCheck.HigherOrder.Testable'' class,- variant of 'Test.QuickCheck.Testable' with an improved instance for @(->)@.+ @Constructible@ class.+ * @Testable'@ class,+ variant of @Testable@ with an improved instance for @(->)@. * Representation of higher-order functions (via test-fun).- * Testable equality 'Test.QuickCheck.HigherOrder.TestEq'.- * Explicit testable type of 'Test.QuickCheck.HigherOrder.Equation'.+ * Testable equality @TestEq@.+ * Explicit testable type of @Equation@. . See also README. homepage: https://github.com/Lysxia/quickcheck-higherorder#readme@@ -21,9 +21,9 @@ copyright: 2020 Li-yao Xia category: Testing build-type: Simple-extra-source-files: README.md+extra-source-files: README.md, CHANGELOG.md cabal-version: >=1.10-tested-with: GHC == 8.0.2 || == 8.2.2 || == 8.4.4 || == 8.6.5 || == 8.8.2+tested-with: GHC == 8.0.2 || == 8.2.2 || == 8.4.4 || == 8.6.5 || == 8.8.2 || == 9.0.2 || == 9.2.1 library hs-source-dirs: src