Of course, if you only need to split the input by lines, you could use lines
.
sepEndBy
in Parsec does what you want - splits input into a list of parsed entities separated by a given separator, optionally ending with it or eof.
Your grammar for line
permits the parser to produce a never-ending stream of lines for any input. This can be resolved by making the decision about newline externally to line:
hsFile' = do
x <- line
xs <- many $ do
newline
line
eof
return (x:xs)
line = many $ noneOf "\n"
This one will produce a empty line at the end in case the file ends with newline.