Proposal: Add foldrWithIndex and foldlWithIndex to Data.List
Edward Kmett
ekmett at gmail.com
Thu Oct 16 19:31:57 UTC 2014
I'm a pretty strong -1 on moving foldrWithIndex into Data.Foldable.
Why?
The only index Foldable can provide is an ordinal index starting at 0.
The one folks _expect_ in many cases from Map k, IntMap and the like is the
key.
This introduces a huge source of potential confusion and new name conflicts
for marginal benefit.
-Edward
On Thu, Oct 16, 2014 at 1:21 PM, David Feuer <david.feuer at gmail.com> wrote:
> Actually, that proposal is firmly in the past. Let's *move* foldrWithIndex
> and foldlWithIndex from Data.Sequence to Data.Foldable!
>
> On Thu, Oct 16, 2014 at 1:14 PM, David Feuer <david.feuer at gmail.com>
> wrote:
>
>> These functions can be lifted pretty much straight out of Data.Sequence.
>> In particular, foldrWithIndex makes for a particularly nice expression of a
>> fusing findIndices function, as is present in Data.Sequence.
>>
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141016/d8a423a3/attachment.html>
More information about the Libraries
mailing list