1
1
mirror of https://github.com/github/semantic.git synced 2024-12-18 12:21:57 +03:00

actualLines ends lines with their newlines.

This commit is contained in:
Rob Rix 2015-12-10 13:15:32 -05:00
parent 0c9308b6ae
commit 7abe07bd16

View File

@ -234,8 +234,6 @@ classify = foldr (const . Just . ("category-" ++)) Nothing
actualLines :: String -> [String]
actualLines "" = [""]
actualLines lines = case break (== '\n') lines of
(l, lines') -> l : (case lines' of
[] -> []
_:lines' -> (case actualLines lines' of
[] -> ["\n"]
s:rest -> ('\n' : s) : rest))
(l, lines') -> (case lines' of
[] -> [ l ]
_:lines' -> (l ++ "\n") : actualLines lines')