Skip to content

Instantly share code, notes, and snippets.

@SAdams601
Created February 20, 2014 11:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SAdams601/b4c1192ed508b86b52c1 to your computer and use it in GitHub Desktop.
Save SAdams601/b4c1192ed508b86b52c1 to your computer and use it in GitHub Desktop.
The non-env using patterns of eval
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