Adding split/split' to Data.List, and redefining words/lines with it; also, adding replace/replaceBy

Alistair Bayley alistair at
Fri Jul 11 05:12:58 EDT 2008

Just wanted to chime in with some historical perspective (no doubt
with a few gaping holes, so feel free to correct me).

There's a brief summary on the wiki of the prior discussions:

These are the two previous threads:

Some interesting points:

 - the lines/words analogy to split/split':
   Which reinforces Gwern's point that the library should have both.

 - Perl, Python, and Ruby do not agree on split semantics:

 - there seems to be some desire for functions splitBy and tokens,
which haven't been mentioned (yet) in this thread, I think.

And finally my opinion:

ByteString split:
>  split 'a'  "aXaXaXa"    == ["","X","X","X",""]

>  split' 'a'  "aXaXaXa" == ["","X","X","X"]

I prefer the ByteString split (i.e. I prefer separator semantics over
terminator), also because it's invertible. Some more support:


More information about the Libraries mailing list