-
-
Save SAdams601/b4c1192ed508b86b52c1 to your computer and use it in GitHub Desktop.
The non-env using patterns of eval
This file contains 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
eval :: Expr -> EvalSt Int | |
eval (N n) = return n | |
eval (Add e1 e2) = do | |
v1 <- eval e1 | |
v2 <- eval e2 | |
return (v1 + v2) | |
eval (Sub e1 e2) = do | |
v1 <- eval e1 | |
v2 <- eval e2 | |
return (v1 - v2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment