Ignore newlines at beginning of file

This commit is contained in:
Joscha 2018-01-24 19:58:22 +00:00
parent 2c292f29c0
commit 4bd5291430

View file

@ -330,7 +330,7 @@ element time = comment <|> (ECard <$> pCard time) <?> "element"
-- Use this parser if you want nice error messages to display.
parseElements :: UTCTime -> Parser Elements
parseElements time = do
elms <- (element time `sepEndBy` some newline) <* label "end of file" eof
elms <- many newline *> (element time `sepEndBy` some newline) <* label "end of file" eof
return $ Elements $ Map.fromList $ zip [1..] elms
-- | The 'parseElements' parser, but simpler to use.