Proposal: alpha-rename the type signatures of foldl, foldl', and scanl to be consistent with foldr and scanr
sol at typeful.net
Sun Oct 14 21:28:01 CEST 2012
On Sun, Oct 14, 2012 at 09:00:18PM +0200, Gábor Lehel wrote:
> On Sun, Oct 14, 2012 at 8:47 PM, Dan Burton <danburton.email at gmail.com> 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.
I'm in favor of the simple change, so +1 ;)
More information about the Libraries