Libraries of standard QuickCheck properties

This in response to a comment on a GHC ticket [1]. I thought it was interesting enough to warrant general discussion. Comment (by JeremyShaw):
Also, where does the H98 report say all instances of Eq must be transitive, reflexive, symmetric, and antisymmetric? It just says "The Eq class provides equality (==)..", whatever that might mean :-)
Well, it does not say it explicitly, but I suspect H98's usage of Eq implicitly demands those laws be followed.
Indeed. The same goes for the implicit law that (x /= y) /= (x == y), since both (/=) and (==) can be overridden. [2] Hopefully in Haskell' the laws
will not only be stated, but there will be some QuickCheck-style properties you can use to test your own instances ;)
This is an interesting thought. Has there been any work towards collecting properties written with QuickCheck (or similar) into a reusable chunk of some form? It would be very convenient to have parametrized properties that tested implicit laws such as equality, monads, and other things that come with the Haskell Platform. Not only would such a library be useful to use, but it would provide a number of readily available examples for would-be testers, thus encouraging testing. Sean [1] http://hackage.haskell.org/trac/ghc/ticket/2528#comment:6 [2] http://www.haskell.org/tutorial/monads.html#sect9.1

2008/8/21 Sean Leather
This in response to a comment on a GHC ticket [1]. I thought it was interesting enough to warrant general discussion.
Comment (by JeremyShaw):
Also, where does the H98 report say all instances of Eq must be transitive, reflexive, symmetric, and antisymmetric? It just says "The Eq class provides equality (==)..", whatever that might mean :-)
Well, it does not say it explicitly, but I suspect H98's usage of Eq implicitly demands those laws be followed.
Indeed. The same goes for the implicit law that (x /= y) /= (x == y), since both (/=) and (==) can be overridden. [2]
Hopefully in Haskell' the laws will not only be stated, but there will be some QuickCheck-style properties you can use to test your own instances ;)
This is an interesting thought. Has there been any work towards collecting properties written with QuickCheck (or similar) into a reusable chunk of some form?
Yes, it's in development, called 'checkers'. code.haskell.org/checkers Luke

This is an interesting thought. Has there been any work towards
collecting > properties written with QuickCheck (or similar) into a reusable chunk of > some form?
Yes, it's in development, called 'checkers'. code.haskell.org/checkers
Great! I especially like the Char generators. This would be nice to eventually have in the Haskell Platform after some general usage and maturity. It would be even better if 'checkers' used QuickCheck 2 when it is released (apparently last week in September [1]). That version works nicely with HUnit. [1] http://thread.gmane.org/gmane.comp.lang.haskell.general/16380 Sean
participants (2)
-
Luke Palmer
-
Sean Leather