Proposal: alpha-rename the type signatures of foldl, foldl', and scanl to be consistent with foldr and scanr
ekmett at gmail.com
Mon Oct 15 07:37:29 CEST 2012
On Sun, Oct 14, 2012 at 7:58 PM, Conrad Parker <conrad at metadecks.org> wrote:
> On 15 October 2012 03:28, Simon Hengel <sol at typeful.net> wrote:
> > 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>
> >> > 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 ;)
> Libraries mailing list
> Libraries at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries