diff options
author | Edoardo La Greca | 2025-07-09 22:24:23 +0200 |
---|---|---|
committer | Edoardo La Greca | 2025-07-09 22:24:23 +0200 |
commit | 9e4698b5e7904e7dafd62a2682713742fd3eb198 (patch) | |
tree | 21971f68e9dc983839b4eb158b0840e0cc78113c /lec05 | |
parent | 9d9039f3e329b45fc25b71cc64d48ff33c08f03c (diff) |
add first exercise of lecture 5
Diffstat (limited to 'lec05')
-rw-r--r-- | lec05/Calc.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lec05/Calc.hs b/lec05/Calc.hs new file mode 100644 index 0000000..8051d76 --- /dev/null +++ b/lec05/Calc.hs @@ -0,0 +1,10 @@ +module Calc where + +import ExprT + +-- Exercise 1 + +eval :: ExprT -> Integer +eval (Lit n) = n +eval (Add l r) = eval l + eval r +eval (Mul l r) = eval l * eval r |