[Haskell-cafe] how do i use quickcheck in the IO monad?

Michał Pałka michal.palka at poczta.fm
Tue Sep 23 06:16:56 EDT 2008

On Mon, 2008-09-22 at 12:35 -0700, Anatoly Yakovenko wrote:
> If i have functions in the IO monad, is there a way to use quickcheck
> to test them?  I have a bunch of C bindings that unfortunately are not
> "safe".  But i would like to be able to use QuickCheck to test them.

Hi Anatoly,

If you want to test some sequential properties then you might use
QuickCheck to generate sequences of actions that the library will
perform and check if the outcomes are correct. If there is no easy way
to verify the results then you may create a model of your library and
compare the results.

This approach is demonstrated in this talk:
where John Hughes tests fread()/fwrite()/fseek() unix functions. He uses
the Erlang version of QuickCheck, but using a Haskell one should allow
you to do the same thing in the IO monad.

There are probably some papers that deal with what you want to do as
well, like this one:
(I haven't read it though).


More information about the Haskell-Cafe mailing list