sebastian.sylvan at gmail.com
Mon Mar 17 14:02:08 EDT 2008
On Mon, Mar 17, 2008 at 1:54 PM, Thomas Schilling <nominolo at googlemail.com>
> 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
> listGen =
> sized (\maxSize -> do
> n <- arbitrary
> x <- g
> xs <- frequency [ (1, return ), (n, listGen g) ]
> return (x:xs)
In retrospect, this function isn't very good at all, because it never
generates the empty list... Something like this is probably better
listGen g = sized (\maxSize -> do
count <- choose (0, maxSize - 1)
replicateM count g )
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe