[Haskell-cafe] Parsec: buildExpressionParser of a different type than parsed term

Joel Reymont joelr1 at gmail.com
Mon Apr 9 15:05:57 EDT 2007


I'm trying to parse NumExpr > NumExpr (example) which should return a  
logical expression while parsing numeric terms. I can't figure out  
how to make buildExpressionParser do this for me since it takes the  
type of the term parser given to it. If I supply a parser for numeric  
terms then I cannot return a logical expression.

How can this be resolved?

Note that I do not want to put all expressions into the same Expr  
type since it makes generating valid random ASTs with QuickCheck  

	Thanks, Joel


More information about the Haskell-Cafe mailing list