At the risk of useless bikeshedding... might I suggest &quot;r&quot; as a mnemonic for &quot;result&quot;?<div><br></div><div>foldl :: (a -&gt; r -&gt; r) -&gt; r -&gt; [a] -&gt; r</div><div>foldr :: (r -&gt; a -&gt; r) -&gt; r -&gt; [a] -&gt; r</div>

<div><br clear="all">-- Dan Burton<br>
<br><br><div class="gmail_quote">On Sun, Oct 14, 2012 at 12:33 PM, Andreas Abel <span dir="ltr">&lt;<a href="mailto:andreas.abel@ifi.lmu.de" target="_blank">andreas.abel@ifi.lmu.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

+1 to all.<div class="HOEnZb"><div class="h5"><br>
<br>
On 14.10.12 6:53 PM, Bas van Dijk wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+1<br>
<br>
There are a few other functions in Data.List that could benefit from<br>
the same treatment:<br>
<br>
mapAccumL :: (acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; [x] -&gt; (acc, [y])<br>
mapAccumL :: (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; [a] -&gt; (acc, [b])<br>
<br>
mapAccumR :: (acc -&gt; x -&gt; (acc, y)) -&gt; acc -&gt; [x] -&gt; (acc, [y])<br>
mapAccumR :: (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; [a] -&gt; (acc, [b])<br>
<br>
genericLength :: Num i =&gt; [b] -&gt; i<br>
genericLength :: Num i =&gt; [a] -&gt; i<br>
<br>
genericSplitAt :: Integral i =&gt; i -&gt; [b] -&gt; ([b], [b])<br>
genericSplitAt :: Integral i =&gt; i -&gt; [a] -&gt; ([a], [a])<br>
<br>
genericIndex :: Integral a =&gt; [b] -&gt; a -&gt; b<br>
genericIndex :: Integral i =&gt; [a] -&gt; i -&gt; a<br>
<br>
I&#39;m not sure if we should change mapAccumL/R since &#39;a&#39; and &#39;acc&#39; are<br>
maybe too similar.<br>
<br>
Bas<br>
<br>
On 14 October 2012 16:28, Gábor Lehel &lt;<a href="mailto:illissius@gmail.com" target="_blank">illissius@gmail.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Currently we have:<br>
<br>
     foldl :: (a -&gt; b -&gt; a) -&gt; a -&gt; [b] -&gt; a<br>
<br>
     foldr :: (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b<br>
<br>
I find this confusing. My brain doesn&#39;t do automatic alpha-renaming,<br>
so I end up thinking that these types are very different because they<br>
look very different. In fact, they are almost the same.<br>
Embarrassingly, it took me longer than it took to understand monads,<br>
GADTs, PolyKinds, and several other things before I realized it!<br>
<br>
So I propose that we use &#39;a&#39; consistently to denote the type of the<br>
list elements, and &#39;b&#39; to denote the type of the result:<br>
<br>
     foldl :: (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b<br>
<br>
     foldr :: (a -&gt; b -&gt; b) -&gt; b -&gt; [a] -&gt; b<br>
<br>
making it obvious that the only difference is the order of parameters<br>
to the accumulator.<br>
<br>
The total change would be to replace<br>
<br>
     Prelude.foldl :: (a -&gt; b -&gt; a) -&gt; a -&gt; [b] -&gt; a<br>
     Prelude.scanl :: (a -&gt; b -&gt; a) -&gt; a -&gt; [b] -&gt; [a]<br>
     Data.List.foldl&#39; :: (a -&gt; b -&gt; a) -&gt; a -&gt; [b] -&gt; a<br>
     Data.Foldable.foldl :: (a -&gt; b -&gt; a) -&gt; a -&gt; t b -&gt; a<br>
     Data.Foldable.foldl&#39; :: (a -&gt; b -&gt; a) -&gt; a -&gt; t b -&gt; a<br>
<br>
with<br>
<br>
     Prelude.foldl :: (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b<br>
     Prelude.scanl :: (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; [b]<br>
     Data.List.foldl&#39; :: (b -&gt; a -&gt; b) -&gt; b -&gt; [a] -&gt; b<br>
     Data.Foldable.foldl :: (b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b<br>
     Data.Foldable.foldl&#39; :: (b -&gt; a -&gt; b) -&gt; b -&gt; t a -&gt; b<br>
<br>
I&#39;ve attached a patch.<br>
<br>
Discussion period: 2 weeks<br>
<br>
Previously discussed at: <a href="http://www.reddit.com/r/haskell/comments/10q2ls/" target="_blank">http://www.reddit.com/r/<u></u>haskell/comments/10q2ls/</a><br>
<br>
--<br>
Your ship was destroyed in a monadic eruption.<br>
<br>
______________________________<u></u>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/libraries</a><br>
<br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/libraries</a><br>
<br>
</blockquote>
<br></div></div><div class="im HOEnZb">
-- <br>
Andreas Abel  &lt;&gt;&lt;      Du bist der geliebte Mensch.<br>
<br>
Theoretical Computer Science, University of Munich<br>
Oettingenstr. 67, D-80538 Munich, GERMANY<br>
<br>
<a href="mailto:andreas.abel@ifi.lmu.de" target="_blank">andreas.abel@ifi.lmu.de</a><br>
<a href="http://www2.tcs.ifi.lmu.de/~abel/" target="_blank">http://www2.tcs.ifi.lmu.de/~<u></u>abel/</a><br>
<br></div><div class="HOEnZb"><div class="h5">
______________________________<u></u>_________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br></div>