Space handling with Parsec

Matthew Danish mdanish at
Mon Nov 5 09:20:13 EST 2007

On Mon, Nov 05, 2007 at 01:18:02PM +0200, Anakreon Mendis wrote:
> What I tried to do is:
> imported the Parsec module, hiding the `space`.
> Reimplemented the space parser as
> space = oneOf [' ', '\t']
> The parser behaved the same.
> Afterwords, I implemented the whiteSpace parser
> as
> whiteSpace = skipMany space
> This didn't work either.

If you're using the lexing functionality found in Parsec.Token then
keep in mind that those combinators will drop whitespace
automatically.  Shadowing the `space' function doesn't affect any
other modules.  If you want whitespace sensitivity then you'll have to
write or use a separate scanner, as described in the manual.

-- Matthew Danish -- user: mrd domain:
-- OpenPGP public key: C24B6010 on

More information about the Libraries mailing list