Skip to content

Commit

Permalink
Fix developBeta in Core/Extra.hs (#1487)
Browse files Browse the repository at this point in the history
fix developBeta
  • Loading branch information
lukaszcz authored Aug 30, 2022
1 parent 3db92fa commit 488a1f1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Juvix/Compiler/Core/Extra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ shift m = umapN go
_ -> n

-- substitute a term t for the free variable with de Bruijn index 0, avoiding
-- variable capture
-- variable capture; shifts all free variabes with de Bruijn index > 0 by -1 (as
-- if the topmost binder was removed)
subst :: Node -> Node -> Node
subst t = umapN go
where
go k n = case n of
Var _ idx | idx == k -> shift k t
Var i idx | idx > k -> Var i (idx - 1)
_ -> n

-- reduce all beta redexes present in a term and the ones created immediately
Expand Down

0 comments on commit 488a1f1

Please sign in to comment.