@@ -42,26 +42,26 @@ shiftUnder : {args : _} ->
4242shiftUnder First = weakenNVar (mkSizeOf args) (MkNVar First )
4343shiftUnder (Later p) = insertNVar (mkSizeOf args) (MkNVar p)
4444
45- shiftVar : {inner : Scope} -> {args : Scope } ->
46- NVar n ((vars ++ args :< x) ++ inner) ->
47- NVar n ((vars :< x ++ args) ++ inner)
45+ shiftVar : {inner : Scope} -> {args : List Name } ->
46+ NVar n ((vars <>< args :< x) ++ inner) ->
47+ NVar n ((vars :< x <>< args) ++ inner)
4848shiftVar nvar
4949 = let inn = mkSizeOf inner in
5050 case locateNVar inn nvar of
51- Left (MkNVar p) => weakenNs inn (shiftUnderNs (mkSizeOf args ) p)
51+ Left (MkNVar p) => weakenNs inn (shiftUndersN (mkSizeOf _ ) p)
5252 Right nvar => embed nvar
5353
5454mutual
5555 shiftBinder : {inner, args : _ } ->
5656 (new : Name) ->
57- CExp (((vars ++ args) :< old) ++ inner) ->
58- CExp ((vars :< new ++ args) ++ inner)
57+ CExp (((vars <>< args) :< old) ++ inner) ->
58+ CExp ((vars :< new <>< args) ++ inner)
5959 shiftBinder new (CLocal fc p)
6060 = case shiftVar (MkNVar p) of
6161 MkNVar p' => CLocal fc (renameVar p')
6262 where
63- renameVar : IsVar x i ((vars :< old ++ args) ++ local) ->
64- IsVar x i ((vars :< new ++ args) ++ local)
63+ renameVar : IsVar x i ((vars :< old <>< args) ++ local) ->
64+ IsVar x i ((vars :< new <>< args) ++ local)
6565 renameVar = believe_me -- it's the same index, so just the identity at run time
6666 shiftBinder new (CRef fc n) = CRef fc n
6767 shiftBinder {inner} new (CLam fc n sc)
@@ -92,27 +92,27 @@ mutual
9292
9393 shiftBinderConAlt : {inner, args : _ } ->
9494 (new : Name) ->
95- CConAlt (((vars ++ args) :< old) ++ inner) ->
96- CConAlt ((vars :< new ++ args) ++ inner)
95+ CConAlt (((vars <>< args) :< old) ++ inner) ->
96+ CConAlt ((vars :< new <>< args) ++ inner)
9797 shiftBinderConAlt new (MkConAlt n ci t args' sc)
98- = let sc' : CExp (((vars ++ args) :< old) ++ (inner ++ args'))
99- = ( rewrite appendAssociative (( vars ++ args) :< old) inner args' in sc) in
98+ = let sc' : CExp (((vars <>< args) :< old) ++ (inner <>< args'))
99+ = rewrite sym $ snocAppendFishAssociative ( vars <>< args : < old) inner args' in sc in
100100 MkConAlt n ci t args' $
101- rewrite sym $ appendAssociative (vars : < new ++ args) inner args' in
101+ rewrite snocAppendFishAssociative (vars : < new <>< args) inner args' in
102102 shiftBinder new sc'
103103
104104 shiftBinderConstAlt : {inner, args : _ } ->
105105 (new : Name) ->
106- CConstAlt (((vars ++ args) :< old) ++ inner) ->
107- CConstAlt ((vars :< new ++ args) ++ inner)
106+ CConstAlt (((vars <>< args) :< old) ++ inner) ->
107+ CConstAlt ((vars :< new <>< args) ++ inner)
108108 shiftBinderConstAlt new (MkConstAlt c sc) = MkConstAlt c $ shiftBinder new sc
109109
110110-- If there's a lambda inside a case, move the variable so that it's bound
111111-- outside the case block so that we can bind it just once outside the block
112112liftOutLambda : {args : _} ->
113113 (new : Name) ->
114- CExp (Scope.bind (Scope.addInner vars args) old) ->
115- CExp (Scope.addInner (Scope.bind vars new) args)
114+ CExp (Scope.bind (Scope.ext vars args) old) ->
115+ CExp (Scope.ext (Scope.bind vars new) args)
116116liftOutLambda = shiftBinder {inner = Scope . empty}
117117
118118-- If all the alternatives start with a lambda, we can have a single lambda
@@ -133,7 +133,7 @@ tryLiftOutConst : (new : Name) ->
133133tryLiftOutConst new [] = Just []
134134tryLiftOutConst new (MkConstAlt c (CLam fc x sc) :: as)
135135 = do as' <- tryLiftOutConst new as
136- let sc' = liftOutLambda {args = [< ]} new sc
136+ let sc' = liftOutLambda {args = []} new sc
137137 pure (MkConstAlt c sc' :: as')
138138tryLiftOutConst _ _ = Nothing
139139
@@ -142,7 +142,7 @@ tryLiftDef : (new : Name) ->
142142 Maybe (Maybe (CExp (Scope.bind vars new)))
143143tryLiftDef new Nothing = Just Nothing
144144tryLiftDef new (Just (CLam fc x sc))
145- = let sc' = liftOutLambda {args = [< ]} new sc in
145+ = let sc' = liftOutLambda {args = []} new sc in
146146 pure (Just sc')
147147tryLiftDef _ _ = Nothing
148148
@@ -318,8 +318,8 @@ doCaseOfCase fc x xalts xdef alts def
318318 updateAlt (MkConAlt n ci t args sc)
319319 = MkConAlt n ci t args $
320320 CConCase fc sc
321- (map (weakenNs (mkSizeOf args)) alts)
322- (map (weakenNs (mkSizeOf args)) def)
321+ (map (weakensN (mkSizeOf args)) alts)
322+ (map (weakensN (mkSizeOf args)) def)
323323
324324 updateDef : CExp vars -> CExp vars
325325 updateDef sc = CConCase fc sc alts def
0 commit comments