-- ** Breaking into lines and words
-- return immediately followed by a line feed, or a carriage return.
-- This accounts for both Unix and Windows line ending conventions,
-- and for the old convention used on Mac OS 9 and earlier.
| otherwise = h : case uncons t of
| c == '\r' -> case uncons t' of
Just ('\n',t'') -> lines t''
- where (h,t) = span notEOL ps
+ where (h,t) = span notEOL ps
notEOL c = c /= '\n' && c /= '\r'
-- | /O(n)/ Joins lines, after appending a terminating newline to
prop_split_i c = id `eq` (T.intercalate (T.singleton c) . T.split c)
prop_splitWith p = splitWith p `eqP` (map unpack . T.splitWith p)
(unpack2 . T.breakSubstring (T.singleton c))
prop_lines = L.lines `eqP` (map unpack . T.lines)
prop_lines' = lines' `eqP` (map unpack . T.lines')
lines' s = let (l, s') = break eol s
('\r':'\n':s'') -> lines' s''
eol c = c == '\r' || c == '\n'
prop_words = L.words `eqP` (map unpack . T.words)
prop_unlines = L.unlines `eq` (unpack . T.unlines . map pack)
prop_unwords = L.unwords `eq` (unpack . T.unwords . map pack)
("prop_breakSubstring_isInfixOf", mytest prop_breakSubstring_isInfixOf),
("prop_lines", mytest prop_lines),
("prop_lines'", mytest prop_lines'),
+("prop_lines'", mytest prop_lines'),
("prop_words", mytest prop_words),
("prop_unlines", mytest prop_unlines),
("prop_unwords", mytest prop_unwords),