Proposal: Add split and splitWith (trac #2048)
duncan.coutts at worc.ox.ac.uk
Thu Jan 17 17:28:32 EST 2008
On Thu, 2008-01-17 at 17:36 +0100, Christian Maeder wrote:
> 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-0.1.0.0 ... linking ... done.
> > Loading package bytestring-0.9.0.1 ... 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.
If everyone thinks this is the right behaviour we can certainly change
Data.ByteString to follow. It is supposed to follow the Data.List api.
More information about the Libraries