tasty-quickcheck-laws-0.0.1: Pre-built tasty trees for checking lawful class properties using QuickCheck

Copyright2018 Automattic Inc.
LicenseGPL-3
MaintainerNathan Bloomfield (nbloomf@gmail.com)
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Test.Tasty.QuickCheck.Laws.Applicative

Contents

Description

Prebuilt tasty test trees for the Applicative functor laws. To get started, look at testApplicativeLaws.

Synopsis

Documentation

testApplicativeLaws Source #

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 f

-> 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 f

-> 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 f

-> 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 f

-> 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 f

-> 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

testApplicativeLaws1 Source #

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 f

-> 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

testApplicativeLaws2 Source #

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 f

-> 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

testApplicativeLaws3 Source #

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 f

-> 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