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

Johan Holmquist holmisen at
Thu May 19 05:27:49 UTC 2016

The discussion period for this proposal is near (31 of May).

So far I count 1 for and 2 against the proposal.

Joachim Breitner made a good enumeration of some advantages of adding these
to base. Here is an enumeration of pros:

* Availability in Data.List gives this pattern a common name.

* A common name for this makes code easier to read and decreases the risk
of getting the definition wrong.

* The argument won't have to be repeated, hence making it easier to chain
the functions.

* List-fusion potential.

Tobias Florek pointed out that `zip <*> tail` can be used to define this
inline without the need for repeating the argument and made a reference to
the Fairbairn threshold. This is elegant, but I am afraid that people might
consider this obscure code golfing if used.

Johan Holmquist

---------- Forwarded message ----------
From: Henning Thielemann <lemming at>
Date: 2016-04-13 13:28 GMT+02:00
Subject: Re: Proposal: Add functions to get consecutive elements to
To: Johan Holmquist <holmisen at>
Cc: Haskell Libraries <libraries at>

On Wed, 13 Apr 2016, Johan Holmquist wrote:

It is not strictly more general because it cannot handle empty sequences.

Think of it as if it handles the non-[] case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list