FP Laboratory 9
Jump to navigation
Jump to search
User defined data types and type classes
Consider following representation of expressions
data Expr = Num Int
| Add Expr Expr
| Sub Expr Expr
| Mul Expr Expr
| Div Expr Expr
| Var Char
deriving (Eq)
- Create function eval that evaluates expresions.
- Create function showExpr that shows expression as a String.
- Extend class Show to be usable with our expressions.
- Create function derivation representing symbolic derivation of a given expression.