<div dir="auto">Despite these subtleties, I must confess I've often wanted to whip up a quick script and been frustrated that these functions are missing from base. For example using Haskell as a sed/awk alternative can be pleasant *if* the functions you need are in base. What's more, in many years I've only really wanted one or two versions of this.<div dir="auto"><br></div><div dir="auto">What if we added the most flexible of versions and included only that? This version would accept multicharacter delimiters, always throw them away, and always produce a new entry in the result for every occurrence of the delimiter. If you don't want the empty entries, you can filter. If you don't want leading, you can dropWhile. If you want the delimiters back, you can map. This seems like a nice trade-off for just being available in base.</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 2, 2018, 1:51 AM Edward Kmett <<a href="mailto:ekmett@gmail.com">ekmett@gmail.com</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">The main thing that prevented it from going into base is the number of subtleties about what precisely it means to properly "split" something.</div><div dir="ltr"><br></div><div dir="ltr">Most languages make fairly arbitrary calls on topics such as:</div><div dir="ltr"><br></div><div dir="ltr">* Do you split on list elements (e.g. <font face="monospace, monospace">','</font>) or list of elements, so you can multi-character delimiters <font face="monospace, monospace">", "</font>? What about multiple types of thing that are all delimiters, e.g. any whitespace character?</div><div dir="ltr">* What do you do with the delimiters?</div><div dir="ltr">* What happens with runs of delimiters? </div><div dir="ltr">* What about initial or final runs of delimiters (e.g. leading spaces)? <br><br>The end result was that a <font face="monospace, monospace">split</font> 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.<br></div><div dir="ltr"><div><br></div><div><a href="http://hackage.haskell.org/package/split-0.2.3.3/docs/Data-List-Split.html" target="_blank" rel="noreferrer">http://hackage.haskell.org/package/split-0.2.3.3/docs/Data-List-Split.html</a></div><div><br></div><div>-Edward</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 1, 2018 at 1:34 PM Saurabh Nanda <<a href="mailto:saurabhnanda@gmail.com" target="_blank" rel="noreferrer">saurabhnanda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">This has certainly been discussed before. A quick Google search turned up the following past discussions:<div><ul><li><a href="https://mail.haskell.org/pipermail/libraries/2006-July/005494.html" target="_blank" rel="noreferrer">https://mail.haskell.org/pipermail/libraries/2006-July/005494.html</a><br></li><li><a href="https://mail.haskell.org/pipermail/libraries/2012-July/018228.html" target="_blank" rel="noreferrer">https://mail.haskell.org/pipermail/libraries/2012-July/018228.html</a><br></li></ul><div>Is there anything blocking this discussion & implementation? Anything that can be done to unblock it?</div></div><div><br></div><div>-- Saurabh.</div><div><br></div></div></div></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>
_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank" rel="noreferrer">Libraries@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries</a><br>
</blockquote></div>