| Copyright | (c) Conal Elliott 2008 |
|---|---|
| License | BSD3 |
| Maintainer | conal@conal.net |
| Stability | experimental |
| Safe Haskell | None |
| Language | Haskell98 |
Test.QuickCheck.Classes
Description
Some QuickCheck properties for standard type classes
Synopsis
- ordRel :: forall a. (Ord a, Show a, Arbitrary a) => BinRel a -> (a -> Gen a) -> TestBatch
- ord :: forall a. (Ord a, Show a, Arbitrary a) => (a -> Gen a) -> TestBatch
- ordMorphism :: (Ord a, Ord b, EqProp b, Show a, Arbitrary a) => (a -> b) -> TestBatch
- semanticOrd :: forall a b. (Model a b, Ord a, Ord b, Show a, Arbitrary a, EqProp b) => a -> TestBatch
- semigroup :: forall a. (Semigroup a, Show a, Arbitrary a, EqProp a) => a -> TestBatch
- monoid :: forall a. (Monoid a, Show a, Arbitrary a, EqProp a) => a -> TestBatch
- monoidMorphism :: (Monoid a, Monoid b, EqProp b, Show a, Arbitrary a) => (a -> b) -> TestBatch
- semanticMonoid :: forall a b. (Model a b, Monoid a, Monoid b, Show a, Arbitrary a, EqProp b) => a -> TestBatch
- functor :: forall m a b c. (Functor m, Arbitrary b, Arbitrary c, CoArbitrary a, CoArbitrary b, Show (m a), Arbitrary (m a), EqProp (m a), EqProp (m c)) => m (a, b, c) -> TestBatch
- functorMorphism :: forall f g. (Functor f, Functor g, Arbitrary (f NumT), Show (f NumT), EqProp (g T)) => (forall a. f a -> g a) -> TestBatch
- semanticFunctor :: forall f g. (Model1 f g, Functor f, Functor g, Arbitrary (f NumT), Show (f NumT), EqProp (g T)) => f () -> TestBatch
- functorMonoid :: forall m a b. (Functor m, Monoid (m a), Monoid (m b), CoArbitrary a, Arbitrary b, Arbitrary (m a), Show (m a), EqProp (m b)) => m (a, b) -> TestBatch
- apply :: forall m a b c. (Apply m, CoArbitrary a, Arbitrary b, CoArbitrary b, Arbitrary c, Arbitrary (m a), Arbitrary (m (b -> c)), Show (m (b -> c)), Arbitrary (m (a -> b)), Show (m (a -> b)), Show (m a), EqProp (m c)) => m (a, b, c) -> TestBatch
- applyMorphism :: forall f g. (Apply f, Apply g, Show (f NumT), Arbitrary (f NumT), EqProp (g T), Show (f (NumT -> T)), Arbitrary (f (NumT -> T))) => (forall a. f a -> g a) -> TestBatch
- semanticApply :: forall f g. (Model1 f g, Apply f, Apply g, Arbitrary (f NumT), Arbitrary (f (NumT -> T)), EqProp (g T), Show (f NumT), Show (f (NumT -> T))) => f () -> TestBatch
- applicative :: forall m a b c. (Applicative m, Arbitrary a, CoArbitrary a, Arbitrary b, Arbitrary (m a), Arbitrary (m (b -> c)), Show (m (b -> c)), Arbitrary (m (a -> b)), Show (m (a -> b)), Show a, Show (m a), EqProp (m a), EqProp (m b), EqProp (m c)) => m (a, b, c) -> TestBatch
- applicativeMorphism :: forall f g. (Applicative f, Applicative g, Show (f NumT), Arbitrary (f NumT), EqProp (g NumT), EqProp (g T), Show (f (NumT -> T)), Arbitrary (f (NumT -> T))) => (forall a. f a -> g a) -> TestBatch
- semanticApplicative :: forall f g. (Model1 f g, Applicative f, Applicative g, Arbitrary (f NumT), Arbitrary (f (NumT -> T)), EqProp (g NumT), EqProp (g T), Show (f NumT), Show (f (NumT -> T))) => f () -> TestBatch
- bind :: forall m a b c. (Bind m, CoArbitrary a, CoArbitrary b, Arbitrary (m a), EqProp (m a), Show (m a), Arbitrary (m b), Arbitrary (m c), EqProp (m c), Arbitrary (m (m (m a))), Show (m (m (m a)))) => m (a, b, c) -> TestBatch
- bindMorphism :: forall f g. (Bind f, Bind g, Show (f NumT), Show (f (f (NumT -> T))), Arbitrary (f NumT), Arbitrary (f T), Arbitrary (f (f (NumT -> T))), EqProp (g T), EqProp (g (NumT -> T))) => (forall a. f a -> g a) -> TestBatch
- semanticBind :: forall f g. (Model1 f g, Bind f, Bind g, EqProp (g T), EqProp (g (NumT -> T)), Arbitrary (f T), Arbitrary (f NumT), Arbitrary (f (f (NumT -> T))), Show (f (f (NumT -> T))), Show (f NumT)) => f () -> TestBatch
- bindApply :: forall m a b. (Bind m, EqProp (m b), Show (m a), Arbitrary (m a), Show (m (a -> b)), Arbitrary (m (a -> b))) => m (a, b) -> TestBatch
- monad :: forall m a b c. (Monad m, Show a, Arbitrary a, CoArbitrary a, CoArbitrary b, Arbitrary (m a), EqProp (m a), Show (m a), Arbitrary (m b), EqProp (m b), Arbitrary (m c), EqProp (m c)) => m (a, b, c) -> TestBatch
- monadMorphism :: forall f g. (Monad f, Monad g, Show (f NumT), Show (f (f (NumT -> T))), Arbitrary (f NumT), Arbitrary (f T), Arbitrary (f (f (NumT -> T))), EqProp (g NumT), EqProp (g T), EqProp (g (NumT -> T))) => (forall a. f a -> g a) -> TestBatch
- semanticMonad :: forall f g. (Model1 f g, Monad f, Monad g, EqProp (g T), EqProp (g NumT), EqProp (g (NumT -> T)), Arbitrary (f T), Arbitrary (f NumT), Arbitrary (f (f (NumT -> T))), Show (f (f (NumT -> T))), Show (f NumT)) => f () -> TestBatch
- monadFunctor :: forall m a b. (Monad m, Arbitrary b, CoArbitrary a, Arbitrary (m a), Show (m a), EqProp (m b)) => m (a, b) -> TestBatch
- monadApplicative :: forall m a b. (Monad m, EqProp (m a), EqProp (m b), Show a, Arbitrary a, Show (m a), Arbitrary (m a), Show (m (a -> b)), Arbitrary (m (a -> b))) => m (a, b) -> TestBatch
- arrow :: forall a b c d e. (Arrow a, Show (a d e), Show (a c d), Show (a b c), Arbitrary (a d e), Arbitrary (a c d), Arbitrary (a b c), Arbitrary c, Arbitrary d, Arbitrary e, CoArbitrary b, CoArbitrary c, CoArbitrary d, EqProp (a b e), EqProp (a b d), EqProp (a (b, d) c), EqProp (a (b, d) (c, d)), EqProp (a (b, e) (d, e)), EqProp (a (b, d) (c, e))) => a b (c, d, e) -> TestBatch
- arrowChoice :: forall a b c d e. (ArrowChoice a, Show (a b c), Arbitrary (a b c), Arbitrary c, Arbitrary e, CoArbitrary b, CoArbitrary d, EqProp (a (Either b d) (Either c e)), EqProp (a (Either b d) (Either c d))) => a b (c, d, e) -> TestBatch
- foldable :: forall t a b m n o. (Foldable t, CoArbitrary a, CoArbitrary b, Arbitrary a, Arbitrary b, Arbitrary o, Arbitrary (t a), Arbitrary (t m), Arbitrary (t n), Arbitrary (t o), Monoid m, Num n, Ord o, EqProp m, EqProp n, EqProp b, EqProp o, EqProp a, Show (t m), Show (t n), Show (t o), Show b, Show (t a), Show o) => t (a, b, m, n, o) -> TestBatch
- foldableFunctor :: forall t a m. (Functor t, Foldable t, CoArbitrary a, Arbitrary m, Arbitrary (t a), EqProp m, Monoid m, Show (t a)) => t (a, m) -> TestBatch
- traversable :: forall f a b m. (Traversable f, Monoid m, Show (f a), Arbitrary (f a), Arbitrary b, Arbitrary m, CoArbitrary a, EqProp (f b), EqProp m) => f (a, b, m) -> TestBatch
- monadPlus :: forall m a b. (MonadPlus m, Show (m a), CoArbitrary a, Arbitrary (m a), Arbitrary (m b), EqProp (m a), EqProp (m b)) => m (a, b) -> TestBatch
- monadOr :: forall m a b. (MonadPlus m, Show a, Show (m a), Arbitrary a, CoArbitrary a, Arbitrary (m a), Arbitrary (m b), EqProp (m a), EqProp (m b)) => m (a, b) -> TestBatch
- alt :: forall f a. (Alt f, Arbitrary (f a), EqProp (f a), Show (f a)) => f a -> TestBatch
- alternative :: forall f a. (Alternative f, Arbitrary (f a), EqProp (f a), Show (f a)) => f a -> TestBatch
Documentation
ordRel :: forall a. (Ord a, Show a, Arbitrary a) => BinRel a -> (a -> Gen a) -> TestBatch #
Total ordering. gen a ought to generate values b satisfying a
fairly often.rel b
semanticOrd :: forall a b. (Model a b, Ord a, Ord b, Show a, Arbitrary a, EqProp b) => a -> TestBatch #
The semantic function (model) for a is an ordMorphism.
semigroup :: forall a. (Semigroup a, Show a, Arbitrary a, EqProp a) => a -> TestBatch #
Properties to check that the Semigroup a satisfies the semigroup
properties. The argument value is ignored and is present only for its
type.
monoid :: forall a. (Monoid a, Show a, Arbitrary a, EqProp a) => a -> TestBatch #
Properties to check that the Monoid a satisfies the monoid
properties. The argument value is ignored and is present only for its
type.
monoidMorphism :: (Monoid a, Monoid b, EqProp b, Show a, Arbitrary a) => (a -> b) -> TestBatch #
Monoid homomorphism properties. See also homomorphism.
semanticMonoid :: forall a b. (Model a b, Monoid a, Monoid b, Show a, Arbitrary a, EqProp b) => a -> TestBatch #
The semantic function (model) for a is a monoidMorphism.
functor :: forall m a b c. (Functor m, Arbitrary b, Arbitrary c, CoArbitrary a, CoArbitrary b, Show (m a), Arbitrary (m a), EqProp (m a), EqProp (m c)) => m (a, b, c) -> TestBatch #
Properties to check that the Functor m satisfies the functor
properties.
functorMorphism :: forall f g. (Functor f, Functor g, Arbitrary (f NumT), Show (f NumT), EqProp (g T)) => (forall a. f a -> g a) -> TestBatch #
Functor morphism (natural transformation) properties
semanticFunctor :: forall f g. (Model1 f g, Functor f, Functor g, Arbitrary (f NumT), Show (f NumT), EqProp (g T)) => f () -> TestBatch #
The semantic function (model1) for f is a functorMorphism.
functorMonoid :: forall m a b. (Functor m, Monoid (m a), Monoid (m b), CoArbitrary a, Arbitrary b, Arbitrary (m a), Show (m a), EqProp (m b)) => m (a, b) -> TestBatch #
apply :: forall m a b c. (Apply m, CoArbitrary a, Arbitrary b, CoArbitrary b, Arbitrary c, Arbitrary (m a), Arbitrary (m (b -> c)), Show (m (b -> c)), Arbitrary (m (a -> b)), Show (m (a -> b)), Show (m a), EqProp (m c)) => m (a, b, c) -> TestBatch #
Properties to check that the Apply m satisfies the apply
properties
applyMorphism :: forall f g. (Apply f, Apply g, Show (f NumT), Arbitrary (f NumT), EqProp (g T), Show (f (NumT -> T)), Arbitrary (f (NumT -> T))) => (forall a. f a -> g a) -> TestBatch #
Apply morphism properties
semanticApply :: forall f g. (Model1 f g, Apply f, Apply g, Arbitrary (f NumT), Arbitrary (f (NumT -> T)), EqProp (g T), Show (f NumT), Show (f (NumT -> T))) => f () -> TestBatch #
The semantic function (model1) for f is an applyMorphism.
applicative :: forall m a b c. (Applicative m, Arbitrary a, CoArbitrary a, Arbitrary b, Arbitrary (m a), Arbitrary (m (b -> c)), Show (m (b -> c)), Arbitrary (m (a -> b)), Show (m (a -> b)), Show a, Show (m a), EqProp (m a), EqProp (m b), EqProp (m c)) => m (a, b, c) -> TestBatch #
Properties to check that the Applicative m satisfies the applicative
properties
applicativeMorphism :: forall f g. (Applicative f, Applicative g, Show (f NumT), Arbitrary (f NumT), EqProp (g NumT), EqProp (g T), Show (f (NumT -> T)), Arbitrary (f (NumT -> T))) => (forall a. f a -> g a) -> TestBatch #
Applicative morphism properties
semanticApplicative :: forall f g. (Model1 f g, Applicative f, Applicative g, Arbitrary (f NumT), Arbitrary (f (NumT -> T)), EqProp (g NumT), EqProp (g T), Show (f NumT), Show (f (NumT -> T))) => f () -> TestBatch #
The semantic function (model1) for f is an applicativeMorphism.
bind :: forall m a b c. (Bind m, CoArbitrary a, CoArbitrary b, Arbitrary (m a), EqProp (m a), Show (m a), Arbitrary (m b), Arbitrary (m c), EqProp (m c), Arbitrary (m (m (m a))), Show (m (m (m a)))) => m (a, b, c) -> TestBatch #
Properties to check that the bind m satisfies the bind properties
bindMorphism :: forall f g. (Bind f, Bind g, Show (f NumT), Show (f (f (NumT -> T))), Arbitrary (f NumT), Arbitrary (f T), Arbitrary (f (f (NumT -> T))), EqProp (g T), EqProp (g (NumT -> T))) => (forall a. f a -> g a) -> TestBatch #
bind morphism properties
semanticBind :: forall f g. (Model1 f g, Bind f, Bind g, EqProp (g T), EqProp (g (NumT -> T)), Arbitrary (f T), Arbitrary (f NumT), Arbitrary (f (f (NumT -> T))), Show (f (f (NumT -> T))), Show (f NumT)) => f () -> TestBatch #
The semantic function (model1) for f is a bindMorphism.
bindApply :: forall m a b. (Bind m, EqProp (m b), Show (m a), Arbitrary (m a), Show (m (a -> b)), Arbitrary (m (a -> b))) => m (a, b) -> TestBatch #
monad :: forall m a b c. (Monad m, Show a, Arbitrary a, CoArbitrary a, CoArbitrary b, Arbitrary (m a), EqProp (m a), Show (m a), Arbitrary (m b), EqProp (m b), Arbitrary (m c), EqProp (m c)) => m (a, b, c) -> TestBatch #
Properties to check that the Monad m satisfies the monad properties
monadMorphism :: forall f g. (Monad f, Monad g, Show (f NumT), Show (f (f (NumT -> T))), Arbitrary (f NumT), Arbitrary (f T), Arbitrary (f (f (NumT -> T))), EqProp (g NumT), EqProp (g T), EqProp (g (NumT -> T))) => (forall a. f a -> g a) -> TestBatch #
Monad morphism properties
Applicative morphism properties
semanticMonad :: forall f g. (Model1 f g, Monad f, Monad g, EqProp (g T), EqProp (g NumT), EqProp (g (NumT -> T)), Arbitrary (f T), Arbitrary (f NumT), Arbitrary (f (f (NumT -> T))), Show (f (f (NumT -> T))), Show (f NumT)) => f () -> TestBatch #
The semantic function (model1) for f is a monadMorphism.
monadFunctor :: forall m a b. (Monad m, Arbitrary b, CoArbitrary a, Arbitrary (m a), Show (m a), EqProp (m b)) => m (a, b) -> TestBatch #
Law for monads that are also instances of Functor.
monadApplicative :: forall m a b. (Monad m, EqProp (m a), EqProp (m b), Show a, Arbitrary a, Show (m a), Arbitrary (m a), Show (m (a -> b)), Arbitrary (m (a -> b))) => m (a, b) -> TestBatch #
arrow :: forall a b c d e. (Arrow a, Show (a d e), Show (a c d), Show (a b c), Arbitrary (a d e), Arbitrary (a c d), Arbitrary (a b c), Arbitrary c, Arbitrary d, Arbitrary e, CoArbitrary b, CoArbitrary c, CoArbitrary d, EqProp (a b e), EqProp (a b d), EqProp (a (b, d) c), EqProp (a (b, d) (c, d)), EqProp (a (b, e) (d, e)), EqProp (a (b, d) (c, e))) => a b (c, d, e) -> TestBatch #
arrowChoice :: forall a b c d e. (ArrowChoice a, Show (a b c), Arbitrary (a b c), Arbitrary c, Arbitrary e, CoArbitrary b, CoArbitrary d, EqProp (a (Either b d) (Either c e)), EqProp (a (Either b d) (Either c d))) => a b (c, d, e) -> TestBatch #
foldable :: forall t a b m n o. (Foldable t, CoArbitrary a, CoArbitrary b, Arbitrary a, Arbitrary b, Arbitrary o, Arbitrary (t a), Arbitrary (t m), Arbitrary (t n), Arbitrary (t o), Monoid m, Num n, Ord o, EqProp m, EqProp n, EqProp b, EqProp o, EqProp a, Show (t m), Show (t n), Show (t o), Show b, Show (t a), Show o) => t (a, b, m, n, o) -> TestBatch #
foldableFunctor :: forall t a m. (Functor t, Foldable t, CoArbitrary a, Arbitrary m, Arbitrary (t a), EqProp m, Monoid m, Show (t a)) => t (a, m) -> TestBatch #
traversable :: forall f a b m. (Traversable f, Monoid m, Show (f a), Arbitrary (f a), Arbitrary b, Arbitrary m, CoArbitrary a, EqProp (f b), EqProp m) => f (a, b, m) -> TestBatch #
monadPlus :: forall m a b. (MonadPlus m, Show (m a), CoArbitrary a, Arbitrary (m a), Arbitrary (m b), EqProp (m a), EqProp (m b)) => m (a, b) -> TestBatch #
Laws for MonadPlus instances with left distribution.
monadOr :: forall m a b. (MonadPlus m, Show a, Show (m a), Arbitrary a, CoArbitrary a, Arbitrary (m a), Arbitrary (m b), EqProp (m a), EqProp (m b)) => m (a, b) -> TestBatch #
Laws for MonadPlus instances with left catch.
alt :: forall f a. (Alt f, Arbitrary (f a), EqProp (f a), Show (f a)) => f a -> TestBatch #
Check Alt Semigroup law
alternative :: forall f a. (Alternative f, Arbitrary (f a), EqProp (f a), Show (f a)) => f a -> TestBatch #
Check Alternative Monoid laws