Don't collapse empty lines in 'lines'

This commit is contained in:
Edwin Brady 2020-05-19 10:44:16 +01:00
parent 8c9eec15a8
commit ba9f14a18c

View File

@ -71,10 +71,13 @@ unwords = pack . unwords' . map unpack
||| lines' (unpack "\rA BC\nD\r\nE\n")
||| ```
lines' : List Char -> List (List Char)
lines' s = case dropWhile isNL s of
[] => []
s' => let (w, s'') = break isNL s'
in w :: lines' s''
lines' [] = []
lines' s = case break isNL s of
(l, s') => l :: case s' of
[] => []
_ :: s'' => lines' (assert_smaller s s'')
||| Splits a string into a list of newline separated strings.
|||