[Haskell-cafe] QuickCheckM with IO? Re: QuickChecking classes

Shae Matijs Erisson shae at ScannedInAvian.com
Wed Mar 23 20:10:26 EST 2005


Benjamin Pierce <bcpierce at cis.upenn.edu> writes:

> Today I've been learning about the wonders of QuickCheck.  :-)
>
> One (obvious?) question that is not addressed in at least the original paper
> is how one might use QC to automatically verify the algebraic laws 

Some utility code is available in the QC.Utils module:
http://www.haskell.org/ghc/docs/latest/html/libraries/QuickCheck/Test.QuickCheck.Utils.html
Also check out Poly and Batch under QuickCheck, tests with timeouts are cool!

For other QuickCheck-related code, Isaac Jones wrote ReactiCheck for use with
Yampa, and I wrote a 'test driven development' version of QuickCheck that saves
failing Gen seeds for the beginning of the next run. 
I think Isaac Jones wrote some code that did more than QuickCheck.Utils for
testing algebraic laws, I think he had some code that tested if 
(a >>= b) >>= c is the same as (a >>= b) >>= c is true for monad instances.

I'd like to try out the unreleased version of QC.
It has 'shrink' that cuts down the generated input list to give you the
smallest failing case. (Not that I've seen it.)

What I do not know how to do, is how to use QuickCheckM to test IO code.
Specifically, the simple demo that would get me started is a QuickCheckM test
that can call one of the simple command-line calculators like bc or dc and
compare it against GHC's result.
If someone can tell me how to do that, I will be very happy.

For my daily paying contract work I'm using HUnit with a simple assertM I
hacked up, but it's just not the same.
-- 
Programming is the Magic Executable Fridge Poetry, | www.ScannedInAvian.com
it is machines made of thought, fueled by ideas.   | -- Shae Matijs Erisson



More information about the Haskell-Cafe mailing list