<div dir="ltr"><div>At the bottom of the Hackage documentation for Text.Megaparsec.Expr [1] is a 13-line demonstration program. It includes no import statements. I added the ones I could deduce, which produced this:<br></div><div><br></div><div><font face="monospace, monospace"> import Text.Megaparsec</font></div><div><font face="monospace, monospace"> import Text.Megaparsec.Expr</font></div><div><font face="monospace, monospace"> import Text.Megaparsec.Lexer (symbol,integer)</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> parens = between (symbol "(") (symbol ")")</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> expr = makeExprParser term table <?> "expression"</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> term = parens expr <|> integer <?> "term"</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> table = [ [ prefix "-" negate</font></div><div><font face="monospace, monospace"> , prefix "+" id ]</font></div><div><font face="monospace, monospace"> , [ postfix "++" (+1) ]</font></div><div><font face="monospace, monospace"> , [ binary "*" (*)</font></div><div><font face="monospace, monospace"> , binary "/" div ]</font></div><div><font face="monospace, monospace"> , [ binary "+" (+)</font></div><div><font face="monospace, monospace"> , binary "-" (-) ] ]</font></div><div><font face="monospace, monospace"> </font></div><div><font face="monospace, monospace"> binary name f = InfixL (reservedOp name >> return f)</font></div><div><font face="monospace, monospace"> prefix name f = Prefix (reservedOp name >> return f)</font></div><div><font face="monospace, monospace"> postfix name f = Postfix (reservedOp name >> return f)</font></div><div><br></div><div>That still won't compile, because GHC does not know what reservedOp means. Does reservedOp refer to something that no longer exists, or have I just not found it?</div><div><br></div><div><br></div><div>[1] <a href="https://hackage.haskell.org/package/megaparsec-4.4.0/docs/Text-Megaparsec-Expr.html">https://hackage.haskell.org/package/megaparsec-4.4.0/docs/Text-Megaparsec-Expr.html</a></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Jeffrey Benjamin Brown</div></div>
</div>