<!--/*SC*/DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"/*EC*/-->
<html><head><title></title></head><body><div style="font-family: Arial; font-size: medium;" dir="ltr"><div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                Mukesh,</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                &nbsp;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                You need to write a generator function for the type (IntMap Index) which</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                keeps track of the n parameter that you&#39;re using in arbIndex.</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                &nbsp;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                You can&#39;t rely on the Arbitrary instance for (IntMap a) because it</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                doesn&#39;t have access to the n parameter that you are so controlling</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                in arbIndex.</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                &nbsp;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                (Actually, you could use the &quot;size&quot; number that QuickCheck keeps</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                behind&nbsp;the scenes, using the functions &quot;sized&quot; and &quot;resize&quot;, but that</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                would have the&nbsp;consequence of affecting all other arbitrary values</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                generated as part of&nbsp;that recursion--including the floats and ints and</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                so on, which may or&nbsp;may not be what you want.)</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                &nbsp;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                Also, since your trees are unranked, rather than binary as in the paper</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                example, take care with the factor of 2 that you&#39;re using to resize the</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                generated subtrees. You might find that the resulting trees are still</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                much bigger than you want, or have different statistical properties.</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                &nbsp;</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                Hope that helps--</div>
        <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; outline-width: 0px; outline-style: initial; outline-color: initial; line-height: normal; background-color: transparent; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; display: block; unicode-bidi: embed; ">
                Ezra</div>
        <div>
                &nbsp;</div>
</div>
<div class="defangedMessage">
        <div id="me69579">
                <div>
                        On Friday, September 23, 2011 4:22 AM, &quot;mukesh tiwari&quot; &lt;mukeshtiwari.iiitm@gmail.com&gt; wrote:</div>
                <blockquote class="me69579QuoteMessage" type="cite">
                        Hello all<br />
                        I have a&nbsp;&nbsp; data type<br />
                        data Index = Index {indexSize::Float, indexIds::[Int], indexDown::(IntMap.IntMap Index)}<br />
                        &nbsp; | IndexLeaf {indexSize::Float, indexIds::[Int]}<br />
                        &nbsp; | IndexEmpty {indexSize::Float}<br />
                        &nbsp; deriving ( Show , Eq )&nbsp;<br />
                        I derived some thing like this for QuickCheck testing<br />
                        instance Arbitrary a =&gt; Arbitrary ( IntMap a )&nbsp; where<br />
                        &nbsp;&nbsp;&nbsp; arbitrary = liftM IntMap.fromList&nbsp; arbitrary<br />
                        <br />
                        instance Arbitrary Index where<br />
                        &nbsp;&nbsp;&nbsp; arbitrary =<br />
                        &nbsp;&nbsp;&nbsp; &nbsp; oneof [ liftM3 Index arbitrary arbitrary arbitrary , liftM2 IndexLeaf arbitrary arbitrary , liftM IndexEmpty arbitrary ]<br />
                        but its generating infinite list of data. After reading the paper <a class="me69579external me69579text" defang_rel="nofollow" href="http://www.eecs.northwestern.edu/%7Erobby/courses/395-495-2009-fall/quick.pdf" title="http://www.cs.chalmers.se/~koen/pubs/icfp00-quickcheck.ps"> QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs</a><a href="http://www.eecs.northwestern.edu/%7Erobby/courses/395-495-2009-fall/quick.pdf"> </a><br />
                        i tried to write above one using sized&nbsp; but i am not sure how to write this .<br />
                        <br />
                        instance Arbitrary a =&gt; Arbitrary ( IntMap a )&nbsp; where<br />
                        &nbsp;&nbsp;&nbsp; arbitrary = liftM IntMap.fromList&nbsp; arbitrary<br />
                        <br />
                        instance&nbsp; Arbitrary Index where<br />
                        &nbsp;&nbsp;&nbsp; arbitrary = sized arbIndex<br />
                        <br />
                        arbIndex 0 = liftM IndexEmpty arbitrary<br />
                        arbIndex 1 = liftM2 IndexLeaf arbitrary arbitrary<br />
                        arbIndex n = frequency [ ( 1 , liftM IndexEmpty arbitrary ) , ( 1 ,&nbsp; liftM2 IndexLeaf arbitrary arbitrary ) , ( 2 , liftM2 Index arbitrary arbitrary ( arbIndex $ div n 2 ) &nbsp; ) ]<br />
                        <br />
                        but from this type i can see arbIndex $ div n 2 will return Gen Index not Gen ( IntMap Index )&nbsp; and i am getting compiler error . Could some one please tell me , how to write arbIndex n in terms of smaller n like in the paper<br />
                        arbTree 0 = liftM Leaf arbitrary<br />
                        arbTree n = frequency[ &nbsp; ( 1 , liftM Leaf arbitrary ) , ( 4 , liftM2 Branch ( arbTree $ div n 2 ) ( arbTree $ div n 2 ) ) ]<br />
                        <br />
                        <br />
                        Thank You<br />
                        Mukesh Tiwari<br />
                        &nbsp;<br />
                        <pre>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

</pre>
                </blockquote>
        </div>
</div>
<div>
        &nbsp;</div>
</div></body></html>