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

Copyright2019 Automattic Inc.
LicenseBSD3
MaintainerNathan Bloomfield (nbloomf@gmail.com)
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Test.Tasty.QuickCheck.Laws.IdentityMonad

Contents

Description

 
Synopsis

Documentation

testIdentityMonadLaws Source #

Arguments

:: (Monad m, Eq a, Eq b, Show t, Show a, Show (m a), Arbitrary t, Arbitrary a, CoArbitrary a, Arbitrary (m a), Arbitrary (m b), Typeable m, Typeable a) 
=> Proxy m

Type constructor under test

-> Proxy t

Equality context for m

-> Proxy a

Value type

-> Proxy b

Value type

-> (forall u. Eq u => t -> m u -> m u -> Bool)

Equality test

-> (forall a. m a -> a)
unwrap
-> TestTree 

Constructs a TestTree checking that the identity monad laws hold for m with value types a and b, using a given equality test for values of type forall u. m u. The equality context type t is for constructors m from which we can only extract a value within a context, such as reader-like constructors.

Identity Monad Laws

testIdentityMonadLawUnwrapReturn Source #

Arguments

:: (Monad m, Eq a, Show a, Show t, Arbitrary t, Arbitrary a, Show (m a)) 
=> Proxy m

Type constructor under test

-> Proxy t

Equality context for m

-> Proxy a

Value type

-> (forall a. m a -> a)
unwrap
-> TestTree 
unwrap . return === id

testIdentityMonadLawReturnUnwrap Source #

Arguments

:: (Monad m, Eq a, Show t, Arbitrary t, Arbitrary (m a), Show (m a)) 
=> Proxy m

Type constructor under test

-> Proxy t

Equality context for m

-> Proxy a

Value type

-> (forall u. Eq u => t -> m u -> m u -> Bool)

Equality test

-> (forall a. m a -> a)
unwrap
-> TestTree 
unwrap . return === id

testIdentityMonadLawBind Source #

Arguments

:: (Monad m, Eq b, Show t, CoArbitrary a, Arbitrary (m b), Arbitrary t, Arbitrary (m a), Show (m a)) 
=> Proxy m

Type constructor under test

-> Proxy t

Equality context for m

-> Proxy a

Value type

-> Proxy b

Value type

-> (forall u. Eq u => t -> m u -> m u -> Bool)

Equality test

-> (forall a. m a -> a)
unwrap
-> TestTree 
unwrap (x >>= f) === unwrap (f (unwrap x))