fix env (should have used an index...)
This commit is contained in:
@@ -54,7 +54,7 @@ dumpCtx : Context -> M String
|
||||
dumpCtx ctx = do
|
||||
let names = (map fst ctx.types)
|
||||
-- I want to know which ones are defines. I should skip the `=` bit if they match, I'll need indices in here too.
|
||||
env <- for (zip ctx.env ctx.types) $ \case
|
||||
env <- for (reverse $ zip ctx.env ctx.types) $ \case
|
||||
(v, n, ty) => do
|
||||
sty <- vprint ctx ty
|
||||
sv <- vprint ctx v
|
||||
@@ -697,7 +697,7 @@ getConstructors ctx scfc (VRef fc nm _) = do
|
||||
top <- getTop
|
||||
case lookup nm top of
|
||||
(Just (MkEntry _ name type (TCon _ names) _)) => pure names
|
||||
_ => error scfc "Not a type constructor \{show nm}"
|
||||
_ => error scfc "Not a type constructor: \{show nm}"
|
||||
lookupDCon : QName -> M (QName × Int × Tm)
|
||||
lookupDCon nm = do
|
||||
top <- getTop
|
||||
|
||||
@@ -74,7 +74,7 @@ tryEval env (VRef fc k sp) = do
|
||||
catchError (
|
||||
do
|
||||
debug $ \ _ => "app \{show name} to \{show sp}"
|
||||
vtm <- eval Nil CBN tm
|
||||
vtm <- eval env CBN tm
|
||||
debug $ \ _ => "tm is \{render 90 $ pprint Nil tm}"
|
||||
val <- vappSpine vtm sp
|
||||
case val of
|
||||
@@ -86,7 +86,9 @@ tryEval env (VRef fc k sp) = do
|
||||
VLetRec _ _ _ _ _ => pure Nothing
|
||||
v => pure $ Just v)
|
||||
(\ _ => pure Nothing)
|
||||
_ => pure Nothing
|
||||
_ => do
|
||||
debug $ \ _ => "tryEval blocked on undefined \{show k}"
|
||||
pure Nothing
|
||||
tryEval _ _ = pure Nothing
|
||||
|
||||
|
||||
|
||||
@@ -178,6 +178,7 @@ pprint' p names (Bnd _ k) = case getAt (cast k) names of
|
||||
pprint' p names (Ref _ str) = text (show str)
|
||||
pprint' p names (Meta _ k) = text "?m:\{show k}"
|
||||
pprint' p names (Lam _ nm icit quant t) = parens 0 p $ nest 2 $ text "\\ \{show quant}\{nm} =>" <+/> pprint' 0 (nm :: names) t
|
||||
-- FIXME - we've lost icity, so we implict app as normal
|
||||
pprint' p names (App _ t u) = parens 0 p $ pprint' 0 names t <+> pprint' 1 names u
|
||||
pprint' p names (UU _) = text "U"
|
||||
pprint' p names (Pi _ nm Auto rig t u) = parens 0 p $
|
||||
|
||||
@@ -162,7 +162,7 @@ processModule importFC base stk qn@(QN ns nm) = do
|
||||
importHints (listValues mod.modDefs)
|
||||
|
||||
log 1 $ \ _ => "process Decls"
|
||||
traverse (tryProcessDecl ns) (collectDecl decls)
|
||||
traverse (tryProcessDecl src ns) (collectDecl decls)
|
||||
|
||||
-- update modules with result, leave the rest of context in case this is top file
|
||||
top <- getTop
|
||||
@@ -178,14 +178,16 @@ processModule importFC base stk qn@(QN ns nm) = do
|
||||
|
||||
(Nil) <- liftIO {M} $ readIORef top.errors
|
||||
| errors => do
|
||||
traverse (putStrLn ∘ showError src) errors
|
||||
-- we're now showing errors when they occur, so they're next to debug messages
|
||||
-- traverse (putStrLn ∘ showError src) errors
|
||||
exitFailure "Compile failed"
|
||||
logMetas $ reverse $ listValues top.metaCtx.metas
|
||||
pure src
|
||||
where
|
||||
tryProcessDecl : List String -> Decl -> M Unit
|
||||
tryProcessDecl ns decl = do
|
||||
tryProcessDecl : String -> List String → Decl -> M Unit
|
||||
tryProcessDecl src ns decl = do
|
||||
(Left err) <- tryError $ processDecl ns decl | _ => pure MkUnit
|
||||
putStrLn $ showError src err
|
||||
addError err
|
||||
|
||||
-- unwind the module part of the path name
|
||||
|
||||
Reference in New Issue
Block a user