Permalink
Browse files

Fix name generation in new evaluator

darcs-hash:20081102153706-228f4-0ea69419ac95e36f75a251d84233b4248d0e314e.gz
  • Loading branch information...
1 parent c2a0583 commit 12c53a81b397093969aa42ece2ff9f23cd997c16 eb committed Nov 2, 2008
Showing with 7 additions and 4 deletions.
  1. +4 −2 Ivor/Evaluator.lhs
  2. +1 −0 Ivor/Nobby.lhs
  3. +2 −2 Ivor/Unify.lhs
View
@@ -27,6 +27,7 @@
> type SEnv = [(Name, TT Name, TT Name)]
> getEnv i env = (\ (_,_,val) -> val) (env!!i)
+> sfst (n,_,_) = n
Code Stack Env Result
@@ -76,8 +77,9 @@ Code Stack Env Result
> evalScope n ty sc (x:xs) env pats = eval sc xs ((n,ty,x):env) pats
> evalScope n ty sc [] env pats
-> | open = let newsc = pToV n (eval sc [] ((n,ty,P n):env) pats) in
-> buildenv env $ unload (Bind n (B Lambda ty) newsc)
+> | open = let n' = uniqify n (map sfst env)
+> newsc = pToV n' (eval sc [] ((n',ty,P n'):env) pats) in
+> buildenv env $ unload (Bind n' (B Lambda ty) newsc)
> [] pats env
> | otherwise
> = buildenv env $ unload (Bind n (B Lambda ty) (Sc sc)) [] pats env -- in Whnf
View
@@ -373,6 +373,7 @@ Do the actual evaluation
> = do newvals <- pmatch pat val vals
> newvals <- checkdups newvals
> pm gam g ps vs ret newvals
+> pm _ _ _ _ _ _ = Nothing
> checkdups v = Just v
View
@@ -73,7 +73,7 @@ Collect names which do unify, and ignore errors
> unifynferr :: Monad m =>
> Bool -> -- Ignore errors
> Env Name -> Indexed Name -> Indexed Name -> m Unified
-> unifynferr ignore env (Ind x) (Ind y)
+> unifynferr ignore env topx@(Ind x) topy@(Ind y)
> = do acc <- un env env x y []
> if ignore then return () else checkAcc acc
> return (acc \\ sentinel)
@@ -114,7 +114,7 @@ Collect names which do unify, and ignore errors
> un envl envr x y acc
> | x == y || ignore = return acc
> | otherwise = fail $ "Can't unify " ++ show x ++
-> " and " ++ show y -- ++ " 1"
+> " and " ++ show y ++ " in " ++ show (topx,topy)
> unb envl envr (B b ty) (B b' ty') acc =
> do acc' <- unbb envl envr b b' acc
> un envl envr ty ty' acc'

0 comments on commit 12c53a8

Please sign in to comment.