<br><br><div class="gmail_quote">On Mon, Mar 17, 2008 at 1:54 PM, Thomas Schilling <<a href="mailto:nominolo@googlemail.com">nominolo@googlemail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
On 17 mar 2008, at 14.37, rodrigo.bonifacio wrote:<br>
<br>
> Hi all,<br>
><br>
> Is it possible to define a limit for the size of children list bellow?<br>
><br>
> I've tried:<br>
><br>
> children <- resize (10 (listGen featureGenNormal))<br>
>><br>
<br>
</div>You are calling a number as a function.<br>
<br>
Also, listGen has to use the size argument. Try something like (not<br>
tested):<br>
<br>
listGen =<br>
sized (\maxSize -> do<br>
n <- arbitrary<br>
x <- g<br>
xs <- frequency [ (1, return []), (n, listGen g) ]<br>
return (x:xs)<br>
<div><div></div></div></blockquote><div><br>In retrospect, this function isn't very good at all, because it never generates the empty list... Something like this is probably better (untested):<br><br>listGen g = sized (\maxSize -> do<br>
count <- choose (0, maxSize - 1)<br> replicateM count g )<br> <br></div></div><br>-- <br>Sebastian Sylvan<br>+44(0)7857-300802<br>UIN: 44640862