<p>How can I give a general rule that includes all the expressions below?
E.g one expression, another one for sub and one for mult.
I need to use recursion but i got confused...</p>

<pre><code>simplify :: Expr-&gt;Expr

simplify (Mult (Const 0)(Var"x"))
 = Const 0 
simplify (Mult (Var "x") (Const 0))
 = Const 0
simplify (Plus (Const 0) (Var "x")) 
= Var "x"
simplify (Plus (Var "x") (Const 0))
 = Var "x" 
simplify (Mult (Const 1) (Var"x")) 
= Var "x"
simplify (Mult(Var"x") (Const 1))
 = Var "x" 
simplify (Minus (Var"x") (Const 0))
 = Var "x"
simplify (Plus (Const x) (Const y)) 
= Const (x + y)
simplify (Minus (Const x) (Const y))
= Const (x - y)
simplify (Mult (Const x) (Const y))
 = Const (x * y)
simplify x = x
</code></pre>

The recursion comes in when you need to deal with nested expressions.  For instance, how do you simply (Plus (Plus 2 3) (Plus 4 5))?
One approach is to break it into two functions.  Move the one level logic (which you show above) into its own function.  The main simplify function might have a rule similar to the following for Plus:
```
```
simplify (Plus x y) = simplify_one_level (Plus (simplify x) (simplify y))
```
```