[Haskell-beginners] QuickCheck 2 entering infinite loop

Brent Yorgey byorgey at seas.upenn.edu
Sat Jan 23 17:38:23 EST 2010


On Fri, Jan 22, 2010 at 04:47:14PM +0000, Dominic Mulligan wrote:
> Dear Brent,
>
> Thanks for the reply.  The type of args is [Type a].  Ascribing a specific 
> type, like so:
>
>  prop_InjectTypeConFreeVars :: [Type String] -> Bool
>  prop_InjectTypeConFreeVars args =
>    (freeTypeVars . (tyCon "Fun")) args == (concatMap freeTypeVars args)
>
> Leads to the same problem; quickCheck is brought to its knees after about 6 
> tests.

I suspect what is happening here is that 'Type' is recursive and
QuickCheck is going crazy generating huge deeply nested random types.
This is rather a failing of QuickCheck.  For the current state of the
art in QuickCheck for recursive data types, see "Generating Recursive
Data Types" here:

  http://www.cs.chalmers.se/~rjmh/QuickCheck/manual.html

although even this leaves a lot to be desired.  There is actually
ongoing research (by me and others) into improving the situation.

-Brent


More information about the Beginners mailing list