Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 0705643

Browse files
authored
Merge pull request #4851 from ziman/fix-lamtolet
Fix `lamToLet` in `Erasure.hs`
2 parents f9161c4 + 85991c9 commit 0705643

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

src/Idris/Erasure.hs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -607,16 +607,13 @@ buildDepMap ci used externs ctx startNames
607607
-- convert applications of lambdas to lets
608608
-- note that this transformation preserves de bruijn numbering
609609
lamToLet :: Term -> Term
610-
lamToLet tm = lamToLet' args f
610+
lamToLet tm = lamToLet' 0 args f
611611
where
612612
(f, args) = unApply tm
613613

614-
lamToLet' :: [Term] -> Term -> Term
615-
lamToLet' (v:vs) (Bind n (Lam rig ty) tm) = Bind n (Let rig ty v) $ lamToLet' vs tm
616-
lamToLet' [] tm = tm
617-
lamToLet' vs tm = error $
618-
"Erasure.hs:lamToLet': unexpected input: "
619-
++ "vs = " ++ show vs ++ ", tm = " ++ show tm
614+
lamToLet' :: Int -> [Term] -> Term -> Term
615+
lamToLet' wk (v:vs) (Bind n (Lam rig ty) tm) = Bind n (Let rig ty (weakenTm wk v)) $ lamToLet' (wk+1) vs tm
616+
lamToLet' wk vs tm = mkApp tm $ map (weakenTm wk) vs
620617

621618
-- split "\x_i -> T(x_i)" into [x_i] and T
622619
unfoldLams :: Term -> ([Name], Term)

src/Idris/IBC.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import System.Directory
4141
import System.FilePath
4242

4343
ibcVersion :: Word16
44-
ibcVersion = 166
44+
ibcVersion = 167
4545

4646
-- | When IBC is being loaded - we'll load different things (and omit
4747
-- different structures/definitions) depending on which phase we're in.

0 commit comments

Comments
 (0)