4 import Text.ParserCombinators.ReadP hiding ((+++), choice)
6 data BinOpType = Add | Sub | Mul
9 | BinOp BinOpType Expr Expr
12 instance Read Expr where
13 readPrec = choice [ parseNum
18 where parseNum = Num <$> readPrec
19 parseBinOp c typ = step $ do
26 return (BinOp typ a b)