[Haskell-cafe] QuickCheck

Thomas Schilling nominolo at googlemail.com
Mon Mar 17 09:54:28 EDT 2008


On 17 mar 2008, at 14.37, rodrigo.bonifacio wrote:

> Hi all,
>
> Is it possible to define a limit for the size of children list bellow?
>
> I've tried:
>
> children <- resize (10 (listGen featureGenNormal))
>>

You are calling a number as a function.

Also, listGen has to use the size argument.  Try something like (not  
tested):

   listGen =
     sized (\maxSize -> do
         n <- arbitrary
         x <- g
         xs <- frequency [ (1, return []), (n, listGen g) ]
         return (x:xs)



More information about the Haskell-Cafe mailing list