Re: [Haskell-cafe] Token parsers in parsec consume trailing whitespace

2009-12-15 Thread Edward Z. Yang
Excerpts from Greg Fitzgerald's message of Mon Dec 14 18:44:37 -0500 2009: It's too bad that the 'nat' function in Token is not defined in Parsec's Char module, and because of that, you need to copy-paste that code or roll your own. Maybe I should write a patch for that. That's correct.

Re: [Haskell-cafe] Token parsers in parsec consume trailing whitespace

2009-12-14 Thread Greg Fitzgerald
Hi Edward, 1. Is there a more elegant way of doing number parsing? In particular, are there token parsers that don't consume trailing whitespace, or is there a better way to do this with the primitives. Parsec defines a combinator it calls 'lexeme' which the tokenizer wraps each of its

[Haskell-cafe] Token parsers in parsec consume trailing whitespace

2009-12-12 Thread Edward Z. Yang
I recently ran into a nasty little bug where token parsers in parsec consume trailing whitespace, which were consuming newlines and thus bamboozling a higher-level sepBy combinator. I replaced my instances of 'natural' with 'read $ many1 digit', but this gave rise to the following questions: 1.