tweaks to playground samples
This commit is contained in:
@@ -308,7 +308,12 @@ process (done,docs) nm = do
|
||||
|
||||
export
|
||||
compile : M (List Doc)
|
||||
-- compile = do
|
||||
-- top <- get
|
||||
-- traverse entryToDoc top.defs
|
||||
compile = reverse . snd <$> process ([],[]) "main"
|
||||
compile = do
|
||||
top <- get
|
||||
case lookup "main" top of
|
||||
Just _ => reverse . snd <$> process ([],[]) "main"
|
||||
-- If there is no main, compile everything for the benefit of the playground
|
||||
Nothing => do
|
||||
top <- get
|
||||
traverse entryToDoc top.defs
|
||||
|
||||
|
||||
@@ -110,20 +110,8 @@ compileTerm (Meta _ k) = pure $ CRef "meta$\{show k}" -- FIXME
|
||||
compileTerm (Lam _ nm t) = pure $ CLam nm !(compileTerm t)
|
||||
compileTerm tm@(App _ _ _) with (funArgs tm)
|
||||
_ | (Meta _ k, args) = do
|
||||
-- FIXME get arity or zonk?
|
||||
-- let's see if this happens after zonking
|
||||
error (getFC tm) "Lambda in CompileExp"
|
||||
-- Maybe we should be storing the Term without the lambdas...
|
||||
-- we don't have a lot here, but JS has an "environment" with names and
|
||||
-- we can assume fully applied.
|
||||
-- meta <- lookupMeta k
|
||||
-- args' <- traverse compileTerm args
|
||||
-- -- apply (CRef "Meta\{show k}") args' [<] 0
|
||||
-- arity <- case meta of
|
||||
-- -- maybe throw
|
||||
-- (Unsolved x j ctx _ _ _) => pure 0 -- FIXME # of Bound in ctx.bds
|
||||
-- (Solved _ j tm) => pure $ lamArity !(quote 0 tm)
|
||||
-- apply (CRef "Meta\{show k}") args' [<] arity
|
||||
-- this will be undefined, should only happen for use metas
|
||||
pure $ CApp (CRef "Meta\{show k}") []
|
||||
_ | (t@(Ref fc nm _), args) = do
|
||||
args' <- traverse compileTerm args
|
||||
arity <- arityForName fc nm
|
||||
@@ -160,4 +148,3 @@ compileFun tm = go tm [<]
|
||||
go tm args = pure $ CFun (args <>> []) !(compileTerm tm)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user