Skip to content

Instantly share code, notes, and snippets.

View joel-costigliola's full-sized avatar

Joel Costigliola joel-costigliola

  • Gentrack
  • Auckland
View GitHub Profile
---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