
17 Jan
2008
17 Jan
'08
10:51 a.m.
Christian Maeder wrote:
Don Stewart wrote:
Note here the funniness of lines, complicates the properties:
[...]
Data.ByteString.Char8.split only behaves differently to the proposed Data.List.split function on empty input lists. (as Twan showed)
last xs == '\n' ==> lines xs == Data.List.split '\n' (init xs)
This property would be wrong for Data.ByteString.Char8.split and "\n". If we ignore the empty input (which is trivial) the following remaining property case is: not (null xs) && last xs /= '\n' ==> Data.List.split '\n' xs = lines (xs ++ "\n") which is true also for Data.ByteString.Char8.split Christian