on master help sign in
Look in the environment before the definitions in executor
commit00299007cb0f7ba6c6fb911a1b91dae78ee91c42 authorDavid Christiansen <david@davidchristiansen.dk> dateFri 3 May 2013, 17:47 (13 years ago) parent350cc02
1 file changed+2
src/Core/Execute.hs+2
src/Core/Execute.hs+2
@@ -167,6 +167,7 @@ ioUnit = ioWrap (EP Ref unitCon EErased)
167167type ExecEnv = [(Name, ExecVal)]
168168
169169doExec :: ExecEnv -> Context -> Term -> Exec ExecVal
170+doExec env ctxt p@(P Ref n ty) | Just v <- lookup n env = return v
170171doExec env ctxt p@(P Ref n ty) =
171172 do let val = lookupDef n ctxt
172173 case val of
@@ -392,6 +393,7 @@ execCase env ctxt ns sc args =
392393 let arity = length ns in
393394 if arity <= length args
394395 then do let amap = zip ns args
396+-- trace ("Case " ++ show sc ++ "\n in " ++ show amap ++"\n in env " ++ show env ++ "\n\n" ) $ return ()
395397 caseRes <- execCase' env ctxt amap sc
396398 case caseRes of
397399 Just res -> Just <$> execApp' (map (\(n, tm) -> (n, tm)) amap ++ env) ctxt res (drop arity args)