Skip to content

Commit

Permalink
Eta reduce under run
Browse files Browse the repository at this point in the history
  • Loading branch information
b-studios committed Dec 27, 2024
1 parent b5dcaef commit f27430a
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ object Normalizer { normal =>

// run { return e } = e
def Run(s: Stmt): Expr = s match {

// run { let x = e; return x } = e
case Stmt.Scope(Definition.Let(id1, _, binding) :: Nil, Stmt.Return(Pure.ValueVar(id2, _))) if id1 == id2 =>
binding

case Stmt.Return(expr) => expr
case _ => core.Run(s)
}
Expand Down

0 comments on commit f27430a

Please sign in to comment.