Skip to content

Commit 5cf02d2

Browse files
committed
ES: as-pat conversion extra comment
1 parent fbc4e0d commit 5cf02d2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

grin/src/Transformations/ExtendedSyntax/Conversion.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,14 @@ instance Convertible Exp New.Exp where
150150
| EBind (SReturn (Var var')) (ConstTagNode tag args) rhs2 <- rhs1
151151
, var == var'
152152
-> pure $ New.EBindF lhs1 (oldNodeToAsPat tag args var) rhs2
153-
{- NOTE:
153+
{- NOTE: The following transformation can be done, because
154+
unit and literal patterns are redundant. If the variable has
155+
the same value as the pattern, then we can safely remove the
156+
binding. If the variable holds some value different from the pattern,
157+
then the program's behaviour is undefined, so we can do anything
158+
with it.
159+
160+
154161
v.0 <- pure <value>
155162
<pat> <- pure v.0 -- pat is neither a node pat nor a var pat
156163
<rhs2>

0 commit comments

Comments
 (0)