Possible Duplicate:
Symbolic simplification in Haskell (using recursion?)
The simplifications I have in mind are
0*e = e*0 = 0
1*e = e*1 = 0+e = e+0 = e-0 = e
and simplifying constant subexpressions, e.g. Plus (Const 1) (Const 2)
would become Const 3
. I would not expect variables (or variables and constants) to be concatenated: Var "st"
is a distinct variable from Var "s"
.
For example simplify(Plus (Var "x") (Const 0))= Var "x"