[Haskell-cafe] Re: A parsec question

Antoine Latter aslatter at gmail.com
Sat Oct 2 21:23:07 EDT 2010


On Wed, Sep 29, 2010 at 1:01 PM, Daniel Fischer
<daniel.is.fischer at web.de> wrote:
> On Wednesday 29 September 2010 19:10:22, Ben Franksen wrote:
>> >
>> > Note the last line mentions only '}'. I would rather like to see
>> >
>> >   expecting "}" or digit
>> >
>> > since the parser could very well accept another digit here.
>
> parsec2 did that, I don't know whether that change is intentional or
> accidental.
>

I came up with a smaller example which shows a similar problem:

> bracket = char '{' *> return ()
> test = bracket *> (bracket <|> return ()) *> char 'a'

For the input "{b" the error message should mention that we can take
either a '{' or an 'a', however it only mentions the 'a'.

However I know how to fix this one, and it doesn't fix the bug
evidenced by the above program.

Antoine


More information about the Haskell-Cafe mailing list