more work on casetree

This commit is contained in:
2024-08-31 14:47:49 -07:00
parent 987ab18b94
commit f3c02ed987
7 changed files with 184 additions and 131 deletions

View File

@@ -24,9 +24,9 @@ getArity _ = Z
export
collectDecl : List Decl -> List Decl
collectDecl [] = []
collectDecl ((Def nm cl) :: rest@(Def nm' cl' :: xs)) =
if nm == nm' then collectDecl (Def nm (cl ++ cl') :: xs)
else (Def nm cl :: collectDecl rest)
collectDecl ((Def fc nm cl) :: rest@(Def _ nm' cl' :: xs)) =
if nm == nm' then collectDecl (Def fc nm (cl ++ cl') :: xs)
else (Def fc nm cl :: collectDecl rest)
collectDecl (x :: xs) = x :: collectDecl xs
export
@@ -52,9 +52,7 @@ processDecl (PFunc fc nm ty src) = do
putStrLn "pfunc \{nm} : \{pprint [] ty'} := \{show src}"
modify $ setDef nm ty' (PrimFn src)
processDecl (Def nm clauses) = do
-- FIXME - I guess we need one on Def, too, or pull off of first clause
let fc = emptyFC
processDecl (Def fc nm clauses) = do
putStrLn "-----"
putStrLn "def \{show nm}"
ctx <- get
@@ -71,7 +69,7 @@ processDecl (Def nm clauses) = do
vty <- eval empty CBN ty
putStrLn "vty is \{show vty}"
tm <- buildTree (mkCtx ctx.metas) (MkProb clauses vty)
tm <- buildTree ({ fc := fc} $ mkCtx ctx.metas) (MkProb clauses vty)
-- tm <- check (mkCtx ctx.metas) body vty
putStrLn "Ok \{pprint [] tm}"