Hi people, i have some haskell problems with expressions. What i am trying to do is add two expressions together and simplify the output. I have this code
What i am trying to achieve is when i write for example Plus (Var "x")(Const 0) in Hugs, to get "Var x". The 0 is disregarded as it adds nothing to x (0 + x = x). If the Const is 1 again the output should be "Var x" as 1 + x = x.Code:module X where type Variable = String data X = Const Integer | Var Variable | Plus X X deriving (Eq, Show)
Any help is appreciated
Thnx
Bookmarks