<br><br><div class="gmail_quote">On Mon, Mar 17, 2008 at 1:54 PM, Thomas Schilling &lt;<a href="mailto:nominolo@googlemail.com">nominolo@googlemail.com</a>&gt; 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>
&gt; Hi all,<br>
&gt;<br>
&gt; Is it possible to define a limit for the size of children list bellow?<br>
&gt;<br>
&gt; I&#39;ve tried:<br>
&gt;<br>
&gt; children &lt;- resize (10 (listGen featureGenNormal))<br>
&gt;&gt;<br>
<br>
</div>You are calling a number as a function.<br>
<br>
Also, listGen has to use the size argument. &nbsp;Try something like (not<br>
tested):<br>
<br>
 &nbsp; listGen =<br>
 &nbsp; &nbsp; sized (\maxSize -&gt; do<br>
 &nbsp; &nbsp; &nbsp; &nbsp; n &lt;- arbitrary<br>
 &nbsp; &nbsp; &nbsp; &nbsp; x &lt;- g<br>
 &nbsp; &nbsp; &nbsp; &nbsp; xs &lt;- frequency [ (1, return []), (n, listGen g) ]<br>
 &nbsp; &nbsp; &nbsp; &nbsp; return (x:xs)<br>
<div><div></div></div></blockquote><div><br>In retrospect, this function isn&#39;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 -&gt; do<br>
&nbsp;&nbsp; count &lt;- choose (0, maxSize - 1)<br>&nbsp;&nbsp; replicateM count g )<br>&nbsp;&nbsp; <br></div></div><br>-- <br>Sebastian Sylvan<br>+44(0)7857-300802<br>UIN: 44640862