Parsec - many and error messages
When I try to parse many p, I do not receive the message "Waiting for p":
> parse (many (char '.') >> eof) "" "a"
Left (line 1, column 1):
unexpected 'a'
expecting end of input
Compare with
> parse (sepBy (char '.') (char ',') >> eof) "" "a"
Left (line 1, column 1):
unexpected 'a'
expecting "." or end of input
which reports ".". as i expected. many1 p <|> return []also works.
All of these functions accept empty input , so why manynot letting them know what it expects? Is this a bug or a function?
manyTill:
> parse (manyTill (char '.') eof) "" "a"
Left (line 1, column 1):
unexpected 'a'
expecting end of input or "."
- , >>. , . many , eof . eof , eof.
manyTill ( -), , ( , <|> ).
, , <?>:
> parse (many (char '.') >> eof <?> "lots of dots") "" "a"
Left (line 1, column 1):
unexpected 'a'
expecting lots of dots
This is a bug introduced in parsec-3.1. If you check previous versions, you will receive an error message that resembles the following:
> parse (many (char '.') >> eof) "" "a"
Left (line 1, column 1):
unexpected 'a'
expecting "." or end of input
At least this is what I get after fixing the error :-)