Skip to content

Commit

Permalink
Use makeLiftedLambda in liftLambdas' after regression test fix in main
Browse files Browse the repository at this point in the history
  • Loading branch information
hmontero1205 committed Nov 26, 2021
1 parent 9c72fdf commit f1e8651
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/IR/LambdaLift.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,13 @@ makeLiftedLambda ((v, t) : vs) body = do

liftLambdas'
:: (I.VarId, I.Expr Poly.Type) -> LiftFn (I.VarId, I.Expr Poly.Type)
liftLambdas' (v, lam@I.Lambda{}) = do
liftLambdas' (v, lam@(I.Lambda _ _ t)) = do
let (vs, body) = I.collectLambda lam
vs' = zipArgsWithArrow vs t
newScope $ catMaybes vs
liftedBody <- liftLambdas body
return (v, updateBody lam liftedBody)
where
updateBody (I.Lambda v' b' t') b = I.Lambda v' (updateBody b' b) t'
updateBody _ b = b
liftedBody <- liftLambdas body
liftedLambda <- makeLiftedLambda vs' liftedBody
return (v, liftedLambda)
liftLambdas' _ = error "Expected top-level lambda binding"

descend :: LiftFn a -> LiftFn (a, M.Map VarId Poly.Type)
Expand Down

0 comments on commit f1e8651

Please sign in to comment.