Skip to content

Commit

Permalink
Merge pull request #4851 from ziman/fix-lamtolet
Browse files Browse the repository at this point in the history
Fix `lamToLet` in `Erasure.hs`
  • Loading branch information
melted committed May 24, 2020
2 parents f9161c4 + 85991c9 commit 0705643
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/Idris/Erasure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -607,16 +607,13 @@ buildDepMap ci used externs ctx startNames
-- convert applications of lambdas to lets
-- note that this transformation preserves de bruijn numbering
lamToLet :: Term -> Term
lamToLet tm = lamToLet' args f
lamToLet tm = lamToLet' 0 args f
where
(f, args) = unApply tm

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

-- split "\x_i -> T(x_i)" into [x_i] and T
unfoldLams :: Term -> ([Name], Term)
Expand Down
2 changes: 1 addition & 1 deletion src/Idris/IBC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import System.Directory
import System.FilePath

ibcVersion :: Word16
ibcVersion = 166
ibcVersion = 167

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

0 comments on commit 0705643

Please sign in to comment.