On Fri, Sep 24, 2010 at 7:09 PM, Milan Straka <span dir="ltr">&lt;<a href="mailto:fox@ucw.cz" target="_blank">fox@ucw.cz</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


There are two thinks to sort out: a) add left/right folds, b) add strict<br>
folds.<br>
<br>
I therefore propose to:<br>
a) add foldrWithKey and foldlWithKey to IntMap, make foldWithKey<br>
   deprecated and synonymous for foldrWithKey.<br></blockquote><div><br></div><div>+1</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
b) add foldl and foldr to Set and IntSet, make fold deprecated<br>
   and synonymous to foldr.<br></blockquote><div><br></div><div>+1</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
c) add strict variants of left and right folds, namely<br>
  Data.Map, Data.IntMap: foldlWithKey&#39; foldrWithKey&#39;<br>
  Data.Set, Date.IntSet: foldl&#39;, foldr&#39;<br></blockquote><div><br></div><div>+1</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Some issues:<br>



- should we really rename fold -&gt; foldr? Maybe we could cla<br>
  that fold and foldWithKey are right folds and add only<br>
  foldl and foldlWithKey.<br></blockquote><div><br></div><div>I&#39;d prefer to rename. We need to keep the old version around for a long time though, with a DEPRECATED pragma encouraging people to upgrade.</div><div> </div>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- should we really deprecate fold and foldWithKey? It could break<br>
  a lot of code.<br></blockquote><div><br></div><div>I think so. Give people a year or so to move over.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



- adding foldl, foldr, foldl&#39; and foldr&#39; to Set and IntSet is going to<br>
  cause a lot of trouble because of shadowing. Maybe some better name?<br>
  On the other hand, these are the &quot;right&quot; names.<br></blockquote><div><br></div><div> I think we should go with the &quot;right&quot; names. I think many modules already import these modules qualified due to other name clashes (as they should). We should encourage proper use of namespaces to resolve name clashes. Breakages can be resolved by putting a upper version bound on containers in the .cabal file of the broken library.</div>

<div><br></div><div>-- Johan</div><div><br></div></div>