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

2007-04-09 Thread Joel Reymont
Folks, 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

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

2007-04-09 Thread Albert Y. C. Lai
Joel Reymont wrote: 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

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

2007-04-09 Thread Joel Reymont
Albert, On Apr 10, 2007, at 12:19 AM, Albert Y. C. Lai wrote: As you probably suspect, one single use of buildExpressionParser cannot accomplish it. It is equivalent to the problem of homogeneous lists. The issue is that I need buildExpressionParser to parse numerical expression but

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

2007-04-09 Thread Albert Y. C. Lai
Albert Y. C. Lai wrote: However, you can make two uses of buildExpressionParser, one for numeric expressions and the other for logical expressions. Mutual reference is no problem since, OK, I now see this is easier said than done in most common applications.