That sounds good to me. In any case the parallel map/fold operations by themselves shouldn't compromise the abstraction.<br><br>Perhaps an eventual solution would be to start including parallel maps/folds right inside the standard libraries. I haven't began testing this yet but it would seem that all the balanced tree implementations are good candidates for a little `par` treatment. Has this been tried somewhere already? <br>
Alas, having par/nonpar versions of library functions compounds the already present monadic/non-monadic schism...<br><br>Anyway, right this second I'm primarily interested in speeding up difference and intersection -- that would be really useful for a simple utility I've been using that compares files as Maps of word-tuples and runs rather slowly (<a href="http://hackage.haskell.org/package/wordsetdiff">http://hackage.haskell.org/package/wordsetdiff</a>).<br>
<br>Cheers,<br>-Ryan<br><br><br><div class="gmail_quote">On Mon, Oct 4, 2010 at 11:00 AM, Bertram Felgenhauer <span dir="ltr"><<a href="mailto:bertram.felgenhauer@googlemail.com" target="_blank">bertram.felgenhauer@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>Ryan Newton wrote:<br>
> Would there be anything wrong with a Data.Set simply chopping off half its<br>
> (balanced) tree and returning two approximately balanced partitions<br>
</div>...<br>
<div>> cleave :: Set a -> (Set a, Set a)<br>
> cleave Tip = (Tip, Tip)<br>
> cleave (Bin _ x l r)<br>
> | size l > size r = (l, insertMin x r)<br>
> | otherwise = (insertMax x l, r)<br>
<br>
</div>This function would expose some of the internal structure of Set - i.e.<br>
there could be equal sets s1 == s2 with cleave s1 /= cleave s2.<br>
<br>
Maybe a better idea than to expose such a function would be to split<br>
Data.Set into Data.Set.Internal and Data.Set, where Data.Set.Internal<br>
would export the actual Tip and Bin constructors. Then people who want<br>
to break the abstraction, for example to experiment with parallel folds,<br>
could do that easily.<br>
<br>
regards,<br>
<font color="#888888"><br>
Bertram<br>
</font></blockquote></div><br>