The problem is on line 56:
P.lexeme <$ string s
Must read:
P.lexeme gmlLexer $ string s
The first construct matched s , and then returned the P.lexeme function as a result of parsing! Subsequent >> discarded the result, so its type is checked.
What you wanted to do is a later line. Apply P.lexeme for your gmlLexer language to the parser to match s .
source share