Proposal: Add a splitBy / splitOn in Data.List

Edward Kmett ekmett at gmail.com
Fri Nov 2 05:51:18 UTC 2018


The main thing that prevented it from going into base is the number of
subtleties about what precisely it means to properly "split" something.

Most languages make fairly arbitrary calls on topics such as:

* Do you split on list elements (e.g. ',') or list of elements, so you can
multi-character delimiters ", "? What about multiple types of thing that
are all delimiters, e.g. any whitespace character?
* What do you do with the delimiters?
* What happens with runs of delimiters?
* What about initial or final runs of delimiters (e.g. leading spaces)?

The end result was that a split package was written by Brent Yorgey back in
2008 or so that rather comprehensively covers the design space, and it was
incorporated into the Haskell Platform.

http://hackage.haskell.org/package/split-0.2.3.3/docs/Data-List-Split.html

-Edward

On Thu, Nov 1, 2018 at 1:34 PM Saurabh Nanda <saurabhnanda at gmail.com> wrote:

> This has certainly been discussed before. A quick Google search turned up
> the following past discussions:
>
>    - https://mail.haskell.org/pipermail/libraries/2006-July/005494.html
>    - https://mail.haskell.org/pipermail/libraries/2012-July/018228.html
>
> Is there anything blocking this discussion & implementation? Anything that
> can be done to unblock it?
>
> -- Saurabh.
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20181102/161d38be/attachment.html>


More information about the Libraries mailing list