The problem is on line 56:
P.lexeme <$ string s
Should read:
P.lexeme gmlLexer $ string s
The former construct was matching s
, then returning the function P.lexeme
as the result of the parse! The subsequent >>
threw the result away, hence it type checked.
What you wanted to do was the later line: Apply the P.lexeme
for your language gmlLexer
to the parser for matching s
.