Variant on Tree, try not to expand too much

This commit is contained in:
2024-10-17 21:54:11 -07:00
parent 05afc10631
commit 41a7563ad5
6 changed files with 118 additions and 9 deletions

View File

@@ -69,10 +69,6 @@ tryEval k sp =
-- Lennart needed more forcing for recursive nat,
forceType : Val -> M Val
forceType tm@(VRef fc nm def sp) =
case !(tryEval nm sp) of
Just tm => pure tm
_ => pure tm
forceType (VMeta fc ix sp) = case !(lookupMeta ix) of
(Unsolved x k xs _) => pure (VMeta fc ix sp)
(Solved k t) => vappSpine t sp >>= forceType

View File

@@ -57,7 +57,7 @@ be acc w k ((i, Line) :: xs) = (be (acc :< LINE i) w i xs)
be acc w k ((i, (Text s)) :: xs) = (be (acc :< TEXT s) w (k + length s) xs)
be acc w k ((i, (Nest j x)) :: xs) = be acc w k ((i+j,x)::xs)
be acc w k ((i, (Seq x y)) :: xs) = be acc w k ((i,x) :: (i,y) :: xs)
-- We're doing extra work here - the first branch should cut if it exhausts w before the first LINE
-- We're doing extra work here - the first branch should cut if it exhausts w - k before the first LINE
be acc w k ((i, (Alt x y)) :: xs) = acc <>> better w k (be [<] w k ((i,x)::xs))
(be [<] w k ((i,y)::xs))

View File

@@ -40,9 +40,10 @@ processDecl (TypeSig fc nm tm) = do
putStrLn "TypeSig \{nm} \{show tm}"
ty <- check (mkCtx top.metas fc) tm (VU fc)
putStrLn "got \{pprint [] ty}"
ty' <- nf [] ty
putStrLn "nf \{pprint [] ty'}"
modify $ setDef nm ty' Axiom
-- I was doing this previously, but I don't want to over-expand VRefs
-- ty' <- nf [] ty
-- putStrLn "nf \{pprint [] ty'}"
modify $ setDef nm ty Axiom
processDecl (PType fc nm ty) = do
ctx <- get

View File

@@ -462,7 +462,7 @@ debug x = do
export
info : FC -> String -> M ()
info fc msg = putStrLn "INFO at \{show fc}: \{show msg}"
info fc msg = putStrLn "INFO at \{show fc}: \{msg}"
||| Version of debug that makes monadic computation lazy
export