Proposal: alpha-rename the type signatures of foldl, foldl', and scanl to be consistent with foldr and scanr

Johan Tibell johan.tibell at
Sun Oct 14 21:19:49 CEST 2012

On Sun, Oct 14, 2012 at 12:00 PM, Gábor Lehel <illissius at> wrote:
> On Sun, Oct 14, 2012 at 8:47 PM, Dan Burton < at> wrote:
>> At the risk of useless bikeshedding... might I suggest "r" as a mnemonic for
>> "result"?
>> foldl :: (a -> r -> r) -> r -> [a] -> r
>> foldr :: (r -> a -> r) -> r -> [a] -> r
>> -- Dan Burton
> 'r' is the version I originally used myself (see reddit). But then you
> have to change the foldrs too, and quite possibly a lot of other
> functions, and get dragged into a big discussion over when is 'r' a
> better mnemonic than 'b' and when is it not.
> Simply swapping 'a' and 'b' in the left folds captures most of the
> benefit for least cost.
> Same goes for most of the other suggestions I have seen (I don't find
> the existing signatures actively confusing, merely suboptimal), but if
> sentiment is overwhelmingly in favor of making further changes I can
> be swayed. For now I wanted to propose a minimal change with the best
> chance of attracting a broad consensus.


More information about the Libraries mailing list