@@ -10,6 +10,7 @@ import Core.Name
1010import Core.Normalise
1111import Core.Options
1212import Core.TT
13+ import Core.TT.Subst
1314import Core.Value
1415
1516import Data.List
@@ -66,7 +67,7 @@ etaExpand i Z exp args = mkApp exp (map (mkLocal (getFC exp)) (reverse args))
6667etaExpand i (S k) exp args
6768 = CLam (getFC exp ) (MN " eta" i)
6869 (etaExpand (i + 1 ) k (weaken exp )
69- (first :: map weakenVar args))
70+ (first :: map later args))
7071
7172export
7273expandToArity : Nat -> CExp vars -> List (CExp vars) -> CExp vars
@@ -229,7 +230,7 @@ mutual
229230 Just gdef <- lookupCtxtExact x (gamma defs)
230231 | Nothing => -- primitive type match
231232 do xn <- getFullName x
232- pure $ MkConAlt xn TYCON Nothing args ! (toCExpTree n sc)
233+ pure $ MkConAlt xn TYCON Nothing (cast args) ! (? sdfds $ toCExpTree n sc)
233234 :: ! (conCases n ns)
234235 case (definition gdef) of
235236 DCon _ arity (Just pos) => conCases n ns -- skip it
@@ -239,8 +240,13 @@ mutual
239240 sc' <- toCExpTree n sc
240241 ns' <- conCases n ns
241242 if dcon (definition gdef)
242- then pure $ MkConAlt xn ! (dconFlag xn) (Just tag) (toList args') (? dfsdf $ shrinkCExp sub (? bfdgdfg sc')) :: ns'
243- else pure $ MkConAlt xn ! (dconFlag xn) Nothing (toList args') (? cbcbcv $ shrinkCExp sub (? gffgh sc')) :: ns'
243+ then pure $ MkConAlt xn ! (dconFlag xn) (Just tag) args' (? dfsdf $ shrinkCExp sub (? bfdgdfg (? sdfdf sc'))) :: ns'
244+ else pure $ MkConAlt xn ! (dconFlag xn) Nothing args' (? cbcbcv $ shrinkCExp sub (? gffgh (? sdfsdfd sc'))) :: ns'
245+ -- $ rewrite sym $ snocAppendAsFish vars args in
246+ -- rewrite fishAsSnocAppend vars args in
247+ -- embed th
248+
249+
244250 where
245251 dcon : Def -> Bool
246252 dcon (DCon {}) = True
@@ -307,11 +313,13 @@ mutual
307313 := rewrite sym $ fishAsSnocAppend vars args in sc'
308314
309315 let scope : CExp ((vars ++ [<MN "eff" 0]) ++ cast args)
316+ -- scope = rewrite sym $ appendAssociative vars [<MN "eff" 0] (cast args) in
317+ -- insertNames {outer=cast args}
318+ -- {inner=vars}
319+ -- {ns = [<MN "eff" 0]}
320+ -- (mkSizeOf _) (mkSizeOf _) sc''
310321 scope = rewrite sym $ appendAssociative vars [< MN " eff" 0 ] (cast args) in
311- insertNames {outer= cast args}
312- {inner= vars}
313- {ns = [< MN " eff" 0 ]}
314- (mkSizeOf _ ) (mkSizeOf _ ) sc''
322+ ? sdfdsf $ insertNames (mkSizeOf _ ) (mkSizeOf _ ) sc''
315323 let tm = CLet fc (MN "eff" 0) NotInline scr (substs (cast s) env scope)
316324 log "compiler.newtype.world" 50 "Kept the scrutinee \{show tm}, scope: \{show scope}"
317325 pure (Just tm)
@@ -546,7 +554,7 @@ lamRHS ns tm
546554 tmExp = substs s env (rewrite appendLinLeftNeutral ns in tm)
547555 newArgs = getNewArgs env
548556 bounds = mkBounds newArgs
549- expLocs = mkLocals zero {vars = Scope . empty} bounds tmExp in
557+ expLocs = mkLocals bounds zero tmExp in
550558 lamBind (getFC tm) _ expLocs
551559 where
552560 lamBind : FC -> (ns : Scope) -> CExp ns -> ClosedCExp
@@ -578,7 +586,7 @@ toCDef n ty _ (ExternDef arity)
578586 -- TODO has quadratic runtime
579587 getVars : ArgList k ns -> List (Var ns)
580588 getVars Z = []
581- getVars (S rest) = first :: map weakenVar (getVars rest)
589+ getVars (S rest) = first :: map later (getVars rest)
582590
583591toCDef n ty _ (ForeignDef arity cs)
584592 = do defs <- get Ctxt
@@ -591,7 +599,7 @@ toCDef n ty _ (Builtin {arity} op)
591599 -- TODO has quadratic runtime
592600 getVars : ArgList k ns -> Vect k (Var ns)
593601 getVars Z = []
594- getVars (S rest) = first :: map weakenVar (getVars rest)
602+ getVars (S rest) = first :: map later (getVars rest)
595603
596604toCDef n _ _ (DCon tag arity pos)
597605 = do let nt = snd <$> pos
0 commit comments