[Haskell-cafe] Parsec Problem

J. Garrett Morris J.Garrett.Morris at Dartmouth.EDU
Tue Jul 27 02:31:08 EDT 2004


--- haskell at alias.spaceandtime.org wrote:
I wish I knew what that meant.  If someone could explain it and tell me
what's wrong, I'd appreciate it.
--- end of quote ---

Lexeme is actually a selector function over the TokenParser record.  In the previous section (also on lexical analysis), he included the code:

module Main where

import Parsec
import qualified ParsecToken as P
import ParsecLanguage( haskellStyle )

lexer :: TokenParser ()
lexer = makeTokenParser
              (haskellDef
                  { reservedOpNames = ["*","/","+","-"]
                  })

whiteSpace= P.whiteSpace lexer
lexeme = P.lexeme lexer               -- <-- here's lexeme
symbol = P.symbol lexer
natural = P.natural lexer
parens = P.parens lexer
semi = P.semi lexer
identifier= P.identifier lexer
reserved = P.reserved lexer
reservedOp= P.reservedOp lexer

Once you've done that, the sample code should work fine.            /gXm


More information about the Haskell-Cafe mailing list