Proposal: Add split and splitWith (trac #2048)
Twan van Laarhoven
twanvl at gmail.com
Wed Jan 16 19:10:36 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-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 hadn't noticed. In my opinion the Data.List version is more consistent,
> split 'a' "xx" == ["xx"]
> split 'a' "x" == ["x"]
> split 'a' "" == [""]
and
> split 'a' "aa" == ["","",""]
> split 'a' "a" == ["",""]
> split 'a' "" == [""]
Versus:
> B.split 'a' "xx" == ["xx"]
> B.split 'a' "x" == ["x"]
> B.split 'a' "" == []
> B.split 'a' "aa" == ["","",""]
> B.split 'a' "a" == ["",""]
> B.split 'a' "" == []
Twan
More information about the Libraries
mailing list