Copyright | (c) Conal Elliott 2008 |
---|---|
License | BSD3 |
Maintainer | conal@conal.net |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
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 n. (Semigroup a, Show a, Arbitrary a, EqProp a, Integral n, Show n, Arbitrary n) => (a, n) -> 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), Show (m (a -> b)), Arbitrary (m (a -> b))) => 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 m, 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
- bifoldable :: forall p a b c m. (Bifoldable p, Monoid m, Show (p a b), Show (p m m), Arbitrary (p a b), Arbitrary (p m m), Arbitrary m, CoArbitrary a, CoArbitrary b, EqProp m, EqProp c, CoArbitrary c, Arbitrary c, Show c) => p a (b, c, m) -> TestBatch
- bifoldableBifunctor :: forall p a b m. (Bifoldable p, Bifunctor p, Monoid m, Show (p a b), Arbitrary (p a b), Arbitrary m, CoArbitrary a, CoArbitrary b, EqProp m) => p a (b, m) -> TestBatch
- traversable :: forall t a b c m f g. (Traversable t, Applicative f, Applicative g, Monoid m, Arbitrary (t a), Arbitrary (t b), Arbitrary (f b), Arbitrary (g c), Arbitrary (t (f (g a))), Arbitrary m, Arbitrary b, CoArbitrary a, CoArbitrary b, Show (t a), Show (t b), Show (t (f (g a))), EqProp (t b), EqProp m, EqProp (f (g (t a))), EqProp (f (g (t c)))) => t (f a, g b, c, 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 Source #
Total ordering.
gen a
ought to generate values b
satisfying a
fairly often.rel
b
ord :: forall a. (Ord a, Show a, Arbitrary a) => (a -> Gen a) -> TestBatch Source #
Ord
laws.
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 Source #
The semantic function (model
) for a
is an ordMorphism
.
semigroup :: forall a n. (Semigroup a, Show a, Arbitrary a, EqProp a, Integral n, Show n, Arbitrary n) => (a, n) -> TestBatch Source #
Properties to check that the Semigroup
a
satisfies the semigroup
properties. The argument value is ignored and is present only for its
type.
Since: 0.5.0
monoid :: forall a. (Monoid a, Show a, Arbitrary a, EqProp a) => a -> TestBatch Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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 Source #
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), Show (m (a -> b)), Arbitrary (m (a -> b))) => m (a, b, c) -> TestBatch Source #
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 Source #
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 Source #
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 Source #
Law for monads that are also instances of Functor
.
Note that instances that satisfy applicative
and monad
are implied to satisfy this property too.
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 Source #
Note that monad
also contains these properties.
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 Source #
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 Source #
foldable :: forall t a b m n o. (Foldable t, CoArbitrary a, CoArbitrary b, Arbitrary a, Arbitrary b, Arbitrary m, 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 Source #
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 Source #
Since: 0.4.13
bifoldable :: forall p a b c m. (Bifoldable p, Monoid m, Show (p a b), Show (p m m), Arbitrary (p a b), Arbitrary (p m m), Arbitrary m, CoArbitrary a, CoArbitrary b, EqProp m, EqProp c, CoArbitrary c, Arbitrary c, Show c) => p a (b, c, m) -> TestBatch Source #
Since: 0.5.7
bifoldableBifunctor :: forall p a b m. (Bifoldable p, Bifunctor p, Monoid m, Show (p a b), Arbitrary (p a b), Arbitrary m, CoArbitrary a, CoArbitrary b, EqProp m) => p a (b, m) -> TestBatch Source #
Since: 0.5.7
traversable :: forall t a b c m f g. (Traversable t, Applicative f, Applicative g, Monoid m, Arbitrary (t a), Arbitrary (t b), Arbitrary (f b), Arbitrary (g c), Arbitrary (t (f (g a))), Arbitrary m, Arbitrary b, CoArbitrary a, CoArbitrary b, Show (t a), Show (t b), Show (t (f (g a))), EqProp (t b), EqProp m, EqProp (f (g (t a))), EqProp (f (g (t c)))) => t (f a, g b, c, m) -> TestBatch Source #
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 Source #
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 Source #
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 Source #
Check Alt Semigroup law
alternative :: forall f a. (Alternative f, Arbitrary (f a), EqProp (f a), Show (f a)) => f a -> TestBatch Source #
Check Alternative Monoid laws