| Copyright | 2018 Automattic Inc. |
|---|---|
| License | BSD3 |
| Maintainer | Nathan Bloomfield (nbloomf@gmail.com) |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Test.Tasty.QuickCheck.Laws.Applicative
Contents
Description
Prebuilt tasty test trees for the Applicative functor laws. To get started, look at testApplicativeLaws.
Synopsis
- testApplicativeLaws :: (Applicative f, Eq a, Eq b, Eq c, Show a, Show t, Show (f a), Show (f (a -> b)), Show (f (b -> c)), Arbitrary a, Arbitrary b, Arbitrary t, Arbitrary (f a), Arbitrary (f (a -> b)), Arbitrary (f (b -> c)), CoArbitrary a, Typeable f, Typeable a, Typeable b, Typeable c) => Proxy f -> Proxy t -> Proxy a -> Proxy b -> Proxy c -> (forall u. Eq u => t -> f u -> f u -> Bool) -> TestTree
- testApplicativeLawIdentity :: (Applicative f, Eq a, Show (f a), Show t, Arbitrary (f a), Arbitrary t) => Proxy f -> Proxy t -> Proxy a -> (forall u. Eq u => t -> f u -> f u -> Bool) -> TestTree
- testApplicativeLawHomomorphism :: (Applicative f, Eq b, Show a, Show t, Arbitrary a, Arbitrary b, Arbitrary t, CoArbitrary a) => Proxy f -> Proxy t -> Proxy a -> Proxy b -> (forall u. Eq u => t -> f u -> f u -> Bool) -> TestTree
- testApplicativeLawInterchange :: (Applicative f, Eq b, Show a, Show t, Show (f (a -> b)), Arbitrary a, Arbitrary t, Arbitrary (f (a -> b))) => Proxy f -> Proxy t -> Proxy a -> Proxy b -> (forall u. Eq u => t -> f u -> f u -> Bool) -> TestTree
- testApplicativeLawComposite :: (Applicative f, Eq c, Show t, Show (f a), Show (f (b -> c)), Show (f (a -> b)), Arbitrary t, Arbitrary (f a), Arbitrary (f (b -> c)), Arbitrary (f (a -> b))) => Proxy f -> Proxy t -> Proxy a -> Proxy b -> Proxy c -> (forall u. Eq u => t -> f u -> f u -> Bool) -> TestTree
- testApplicativeLaws1 :: (Applicative f, Checkable a, Show (f a), Show t, Show (f (a -> a)), Arbitrary (f a), Arbitrary t, Arbitrary (f (a -> a)), Typeable f) => Proxy f -> Proxy t -> Proxy a -> (forall u. Eq u => t -> f u -> f u -> Bool) -> TestTree
- testApplicativeLaws2 :: (Applicative f, Checkable a, Checkable b, Show (f a), Show (f b), Show t, Show (f (a -> a)), Show (f (a -> b)), Show (f (b -> a)), Show (f (b -> b)), Arbitrary (f a), Arbitrary (f b), Arbitrary t, Arbitrary (f (a -> a)), Arbitrary (f (a -> b)), Arbitrary (f (b -> a)), Arbitrary (f (b -> b)), Typeable f) => Proxy f -> Proxy t -> Proxy a -> Proxy b -> (forall u. Eq u => t -> f u -> f u -> Bool) -> TestTree
- testApplicativeLaws3 :: (Applicative f, Checkable a, Checkable b, Checkable c, Show (f a), Show (f b), Show (f c), Show t, Show (f (a -> a)), Show (f (a -> b)), Show (f (a -> c)), Show (f (b -> a)), Show (f (b -> b)), Show (f (b -> c)), Show (f (c -> a)), Show (f (c -> b)), Show (f (c -> c)), Arbitrary (f a), Arbitrary (f b), Arbitrary (f c), Arbitrary t, Arbitrary (f (a -> a)), Arbitrary (f (a -> b)), Arbitrary (f (a -> c)), Arbitrary (f (b -> a)), Arbitrary (f (b -> b)), Arbitrary (f (b -> c)), Arbitrary (f (c -> a)), Arbitrary (f (c -> b)), Arbitrary (f (c -> c)), Typeable f) => Proxy f -> Proxy t -> Proxy a -> Proxy b -> Proxy c -> (forall u. Eq u => t -> f u -> f u -> Bool) -> TestTree
Documentation
Arguments
| :: (Applicative f, Eq a, Eq b, Eq c, Show a, Show t, Show (f a), Show (f (a -> b)), Show (f (b -> c)), Arbitrary a, Arbitrary b, Arbitrary t, Arbitrary (f a), Arbitrary (f (a -> b)), Arbitrary (f (b -> c)), CoArbitrary a, Typeable f, Typeable a, Typeable b, Typeable c) | |
| => Proxy f | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> Proxy b | Value type |
| -> Proxy c | Value type |
| -> (forall u. Eq u => t -> f u -> f u -> Bool) | Equality test |
| -> TestTree |
Constructs a TestTree checking that the four Applicative class laws hold for f with value types a, b, and c, using a given equality test for values of type forall u. f u. The equality context type t is for constructors f from which we can only extract a value within a context, such as reader-like constructors.
Applicative Laws
testApplicativeLawIdentity Source #
Arguments
| :: (Applicative f, Eq a, Show (f a), Show t, Arbitrary (f a), Arbitrary t) | |
| => Proxy f | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> (forall u. Eq u => t -> f u -> f u -> Bool) | Equality test |
| -> TestTree |
pure id <*> x === x
testApplicativeLawHomomorphism Source #
Arguments
| :: (Applicative f, Eq b, Show a, Show t, Arbitrary a, Arbitrary b, Arbitrary t, CoArbitrary a) | |
| => Proxy f | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> Proxy b | Value type |
| -> (forall u. Eq u => t -> f u -> f u -> Bool) | Equality test |
| -> TestTree |
pure f <*> pure a === pure (f a)
testApplicativeLawInterchange Source #
Arguments
| :: (Applicative f, Eq b, Show a, Show t, Show (f (a -> b)), Arbitrary a, Arbitrary t, Arbitrary (f (a -> b))) | |
| => Proxy f | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> Proxy b | Value type |
| -> (forall u. Eq u => t -> f u -> f u -> Bool) | Equality test |
| -> TestTree |
x <*> pure a === pure ($ a) <*> x
testApplicativeLawComposite Source #
Arguments
| :: (Applicative f, Eq c, Show t, Show (f a), Show (f (b -> c)), Show (f (a -> b)), Arbitrary t, Arbitrary (f a), Arbitrary (f (b -> c)), Arbitrary (f (a -> b))) | |
| => Proxy f | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> Proxy b | Value type |
| -> Proxy c | Value type |
| -> (forall u. Eq u => t -> f u -> f u -> Bool) | Equality test |
| -> TestTree |
pure (.) <*> x <*> y <*> z = x <*> (y <*> z)
Test Trees
Arguments
| :: (Applicative f, Checkable a, Show (f a), Show t, Show (f (a -> a)), Arbitrary (f a), Arbitrary t, Arbitrary (f (a -> a)), Typeable f) | |
| => Proxy f | Type constructor under test |
| -> Proxy t | Equality context type for |
| -> Proxy a | Value type |
| -> (forall u. Eq u => t -> f u -> f u -> Bool) | Equality test |
| -> TestTree |
All possible value type selections for testApplicativeLaws from one choice
Arguments
| :: (Applicative f, Checkable a, Checkable b, Show (f a), Show (f b), Show t, Show (f (a -> a)), Show (f (a -> b)), Show (f (b -> a)), Show (f (b -> b)), Arbitrary (f a), Arbitrary (f b), Arbitrary t, Arbitrary (f (a -> a)), Arbitrary (f (a -> b)), Arbitrary (f (b -> a)), Arbitrary (f (b -> b)), Typeable f) | |
| => Proxy f | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> Proxy b | Value type |
| -> (forall u. Eq u => t -> f u -> f u -> Bool) | Equality test |
| -> TestTree |
All possible value type selections for testApplicativeLaws from two choices
Arguments
| :: (Applicative f, Checkable a, Checkable b, Checkable c, Show (f a), Show (f b), Show (f c), Show t, Show (f (a -> a)), Show (f (a -> b)), Show (f (a -> c)), Show (f (b -> a)), Show (f (b -> b)), Show (f (b -> c)), Show (f (c -> a)), Show (f (c -> b)), Show (f (c -> c)), Arbitrary (f a), Arbitrary (f b), Arbitrary (f c), Arbitrary t, Arbitrary (f (a -> a)), Arbitrary (f (a -> b)), Arbitrary (f (a -> c)), Arbitrary (f (b -> a)), Arbitrary (f (b -> b)), Arbitrary (f (b -> c)), Arbitrary (f (c -> a)), Arbitrary (f (c -> b)), Arbitrary (f (c -> c)), Typeable f) | |
| => Proxy f | Type constructor under test |
| -> Proxy t | Equality context for |
| -> Proxy a | Value type |
| -> Proxy b | Value type |
| -> Proxy c | Value type |
| -> (forall u. Eq u => t -> f u -> f u -> Bool) | Equality test |
| -> TestTree |
All possible value type selections for testApplicativeLaws from three choices