You can write your own generators and use the forall function. Or for these simple examples you can just test on wrappers:

testFoo :: (a,a,a,[a]) -> IO Bool
testFoo (a1,a2,a3,as) = foo (a1:a2:a3:as)

testBar :: (a,[a]) -> Int -> IO ()
testBar (x,xs) n = bar xs' (n `mod` length xs') where xs' = x:xs 

/J

On 25 May 2011 12:40, Guy <guytsalmaves-h@yahoo.com> wrote:
I have some functions with preconditions. For example, foo::[a]->IO Bool requires a list of at least three elements, and bar::[a]->Int->IO () requires that its second argument is some position within the list.

How can I test these with quickcheck? If I use ==>, quickcheck gives up with very few test cases.


_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners