Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data Polynomial = Var String -- Variables
- | Const Integer -- Constant numbers
- | Add Polynomial Polynomial -- Addition
- | Mul Polynomial Polynomial -- Multiplication
- instance Show Polynomial where
- show (Var x) = show x
- show (Const x) = show x
- show (Add x y) = "(" ++ filter (/= '"') (show x) ++ "+" ++ filter (/= '"') (show x) ++ ")"
- show (Mul x y) = "(" ++ filter (/= '"') (show x) ++ "*" ++ filter (/= '"') (show x) ++ ")"
- instance Eq Polynomial where
- (Polynomial x) == (Polynomial y) =
Add Comment
Please, Sign In to add comment