Created
January 16, 2017 20:04
-
-
Save deque-blog/a457bec3e99597b946ca04ea61700999 to your computer and use it in GitHub Desktop.
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
type Env = Map.Map String Int | |
eval :: Env -> Expr -> Int | |
eval env (Cst n) = n | |
eval env (Var v) = env Map.! v | |
eval env (Op Add xs) = sum $ map (eval env) xs | |
eval env (Op Mul xs) = product $ map (eval env) xs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment