This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---Very simple evaluation for arithmetic expressions with only constants | |
---(and only "plus"...obviously extendable to other operations) | |
data Expr = C Float | | |
Expr :+ Expr | |
deriving Show | |
eval :: Expr -> Float | |
eval (C x) = x | |
eval (e1 :+ e2) = let v1 = eval e1 |