Proposal: Add split and splitWith (trac #2048)

Christian Maeder Christian.Maeder at
Thu Jan 17 11:36:07 EST 2008

Ian Lynagh wrote:
> One or the other should be changed so that these agree:
> *Main> split 'a' ""
> [""]
> *Main> Data.ByteString.Char8.split 'a' (Data.ByteString.Char8.pack "")
> Loading package array- ... linking ... done.
> Loading package bytestring- ... linking ... done.
> []
> although I couldn't say which is "right" OTTOMH...

I've convinced myself (see my previous mails) that Twan's version is
right and Data.ByteString.Char8.split should be changed (and all its
usages need to be checked)!

The documentation in both modules should contain the example!
  split c [] == [[]]

I don't think that the oddity of Data.ByteString.Char8.split on empty
input helps to establish the treatment of a missing final newline for
the lines function.


More information about the Libraries mailing list