Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
partial :: Env -> Expr -> Expr
partial env = cata (compAll [optimizeMul, optimizeAdd, replaceKnownVars env])
eval :: Env -> Expr -> Int
eval env expr =
case partial env expr of
(Fix (Cst n)) -> n
e -> error $ "Missing vars: " ++ show (dependencies e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment