| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Test.Hspec.QuickCheck.Classes
Documentation
testLaws :: forall {k} (a :: k). (Typeable a, HasCallStack) => [Proxy a -> Laws] -> Spec Source #
Tests that a type satisfies the laws of one or more typeclasses.
For example, to test that Bool satisfies the laws of Eq, Ord, and
Show:
testLaws@Bool[eqLaws,ordLaws,showLaws]
Kind polymorphism
The testLaws function can also test instances of type classes whose type
parameters are not of kind Type.
For example, with Maybe, which has kind :Type -> Type
testLaws@Maybe[applicativeLaws,functorLaws,monadLaws,foldableLaws,traversableLaws]
And with Either, which has kind :Type -> Type -> Type
testLaws@Either[bifoldableLaws,bifunctorLaws,bitraversableLaws]