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

Alistair Bayley alistair at abayley.org
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:
http://www.haskell.org/haskellwiki/List_function_suggestions

These are the two previous threads:
http://www.haskell.org/pipermail/haskell-cafe/2006-July/thread.html#16559
http://www.haskell.org/pipermail/libraries/2004-July/thread.html#2342


Some interesting points:

 - the lines/words analogy to split/split':
    http://www.haskell.org/pipermail/libraries/2004-July/002352.html
   Which reinforces Gwern's point that the library should have both.

 - Perl, Python, and Ruby do not agree on split semantics:
    http://www.haskell.org/pipermail/libraries/2004-July/002351.html

 - 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",""]

Neil's:
>  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:
  http://www.haskell.org/pipermail/haskell-cafe/2006-July/016649.html

Alistair


More information about the Libraries mailing list