Proposal: Add functions to get consecutive elements to Data.List

Johan Holmquist holmisen at gmail.com
Wed Apr 13 05:45:54 UTC 2016


Yes, mapAdjacent is mentioned in the linked feature request.

But simply importing does not help, because one also need to manage another
dependency in the project then. Adding another dependency is a rather big
deal, so if one only needs a single, simple function from a package one
will have to consider whether to add that dependency or just define the
function in the project's utility module. Also one first had to find out
about the utility-ht library and its definition of mapAdjacent.

I am proposing inclusion into base to make it readily available out of the
box. I think it would fit rather well together with the other zips in
Data.List.

2016-04-12 23:01 GMT+02:00 Henning Thielemann <lemming at henning-thielemann.de
>:

>
> On Tue, 12 Apr 2016, Johan Holmquist wrote:
>
>     zipConsecutivesWith :: (a -> a -> b) -> [a] -> [b]
>>     zipConsecutivesWith f xs = zipWith f xs (tail xs)
>>
>
> I call it mapAdjacent in my utility-ht package:
>
> http://hackage.haskell.org/package/utility-ht-0.0.11/docs/Data-List-HT.html#v:mapAdjacent
>
> You could simply import that one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20160413/155dbebe/attachment.html>


More information about the Libraries mailing list