Re: [Haskell-cafe] Re: [Parsec] Backtracking with try does not work for me?

2006-08-02 Thread Andrew Pimlott
On Tue, Aug 01, 2006 at 10:08:16PM +0200, Stephane Bortzmeyer wrote: notFollowedBy seems to work for me and is quite simple, even for my brain. Thanks. Actually, it doesn't work, and is quite subtle, at least for my brain. There was a discussion in this thread:

[Haskell-cafe] Re: [Parsec] Backtracking with try does not work for me?

2006-08-01 Thread Stephane Bortzmeyer
On Tue, Aug 01, 2006 at 09:41:40AM +0100, Chris Kuklewicz [EMAIL PROTECTED] wrote a message of 105 lines which said: The problem is mentioned here: http://www.cs.uu.nl/people/daan/download/parsec/parsec.html#notFollowedBy notFollowedBy seems to work for me and is quite simple, even for my

Re: [Haskell-cafe] Re: [Parsec] Backtracking with try does not work for me?

2006-08-01 Thread Udo Stenzel
Stephane Bortzmeyer wrote: The first would be to test whether bb is followed by eof or comma before accepting it. notFollowedBy actually does the opposite (checking that there are no more letters). Are you sure that you don't actually want * many1 letter `sepBy1` comma ? Just asking,

[Haskell-cafe] Re: [Parsec] Backtracking with try does not work for me?

2006-07-31 Thread Stephane Bortzmeyer
On Mon, Jul 31, 2006 at 10:59:14AM +0200, Matthias Fischmann [EMAIL PROTECTED] wrote a message of 89 lines which said: try b | (return '-') ... The (return 'x') is needed for type consistency. OK, it works. Many thanks for the solution and the explanations.

[Haskell-cafe] Re: [Parsec] Backtracking with try does not work for me?

2006-07-31 Thread Stephane Bortzmeyer
On Mon, Jul 31, 2006 at 12:57:04PM +0200, Udo Stenzel [EMAIL PROTECTED] wrote a message of 59 lines which said: Now 'optional x' always succeeds, so the 'try' is useless where you placed it. You need to 'try' the argument to 'optional': It works, too. Many thanks for the code and the

[Haskell-cafe] Re: [Parsec] Backtracking with try does not work for me?

2006-07-31 Thread Stephane Bortzmeyer
On Mon, Jul 31, 2006 at 06:51:27PM +0100, Chris Kuklewicz [EMAIL PROTECTED] wrote a message of 102 lines which said: minilang = do char 'a' optional (try (do {comma ; char 'b'})) optional (do {comma ; char 'c'}) eof return OK I now have a new problem which