Skip to content

Commit

Permalink
[ clean ] remove underLambdas and underAbs
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Feb 22, 2024
1 parent 91176a7 commit 2f69f2a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
2 changes: 0 additions & 2 deletions src/full/Agda/TypeChecking/RecordPatterns.hs
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ recordExpressionsToCopatterns = \case
-- -- go from level (i + n - 1) to index (subtract from |xs|-1)
-- index = length xs - (i + n)
-- in Done xs' $ applySubst (liftS (length xs2) $ us ++# raiseS 1) v
-- -- The body is NOT guarded by lambdas!
-- -- WRONG: underLambdas i (flip apply) (map defaultArg us) v
--
-- Fail -> Fail
--
Expand Down
22 changes: 0 additions & 22 deletions src/full/Agda/TypeChecking/Substitute/Class.hs
Original file line number Diff line number Diff line change
Expand Up @@ -326,25 +326,3 @@ mkAbs x v | 0 `freeIn` v = Abs x v
reAbs :: (Subst a, Free a) => Abs a -> Abs a
reAbs (NoAbs x v) = NoAbs x v
reAbs (Abs x v) = mkAbs x v

-- | @underAbs k a b@ applies @k@ to @a@ and the content of
-- abstraction @b@ and puts the abstraction back.
-- @a@ is raised if abstraction was proper such that
-- at point of application of @k@ and the content of @b@
-- are at the same context.
-- Precondition: @a@ and @b@ are at the same context at call time.
underAbs :: Subst a => (a -> b -> b) -> a -> Abs b -> Abs b
underAbs cont a = \case
Abs x t -> Abs x $ cont (raise 1 a) t
NoAbs x t -> NoAbs x $ cont a t

-- | @underLambdas n k a b@ drops @n@ initial 'Lam's from @b@,
-- performs operation @k@ on @a@ and the body of @b@,
-- and puts the 'Lam's back. @a@ is raised correctly
-- according to the number of abstractions.
underLambdas :: TermSubst a => Int -> (a -> Term -> Term) -> a -> Term -> Term
underLambdas n cont = loop n where
loop 0 a = cont a
loop n a = \case
Lam h b -> Lam h $ underAbs (loop $ n-1) a b
_ -> __IMPOSSIBLE__

0 comments on commit 2f69f2a

Please sign in to comment.