Hi Matthias,

On Wed, May 30, 2012 at 1:36 PM, Matthias Hörmann <mhoermann@gmail.com> wrote:
parseTest (do; r1 <- anyOf ["Hello", "Hallo", "Foo", "HallofFame"]; r2 <- string "bla"; return (r1, r2)) "Hallofbla"

which prints this:

parse error at (line 1, column 8):unknown parse error

And my question about this is made up of two parts

1. Why doesn't it print my "unexpected" message but instead says unknown parse error
2. Why is the location in the text off (I would expect it to fail at column 6 (first character beyond the result it could return) or 7 (first character that makes the string no prefix of any acceptable string)

What version of parsec 3 are you using? In version 3.1.1, I get (using Text.Parsec.String instead of Text.Parsec.Text):

parse error at (line 1, column 1):
unexpected "Hallofb", expecting one of ["Hello","Hallo","Foo","HallofFame"]

which is what I would have expected, bearing in mind that 'try p' pretends that it hasn't consumed input when 'p' fails.

I don't think you need to use 'try' in your 'anyOf' function, but you'll have to change it to handle seeing the end of input if the one-character look-ahead fails.

Kevin
-- 
Kevin Charter
kevin.charter@acm.org