Skip to content

jonathanknowles/hspec-quickcheck-classes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hspec-quickcheck-classes

Latest Release Development Branch

This package integrates Hspec with quickcheck-classes, making it convenient for Hspec test suites to include tests for the lawfulness of type class instances.

Usage

To test that a type satisfies the laws of one or more type classes:

testLaws @Bool
  [ eqLaws
  , ordLaws
  , showLaws
  ]

Kind polymorphism

The testLaws function is kind-polymorphic, supporting type parameters of any kind.

This means it can be used to 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
  ]

About

Hspec support for quickcheck-classes

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors