Alternatively you could refactor your language to have binary operations on one hand and unary ones on the other. You'd write:
data BinOp = PlusOp | MultOp deriving (Show, Eq)
data UnOp = ConstOp deriving (Show, Eq)
data Expr = Bin BinOp Expr Expr
| Un UnOp Expr
deriving (Show,
…
Top comments (0)