@@ -44,7 +44,7 @@ copyPropagation = flip evalState mempty . hyloM rmBlocks builder where
4444 builder :: Exp -> State Env (ExpF Exp )
4545 builder exp = do
4646 (origVals, aliases) <- get
47- -- this substitutes all the variables on this level with their original aliases
47+ -- This substitutes all the variables on this level with their original aliases
4848 let exp' = substVarRefExp aliases $ exp
4949
5050 case exp' of
@@ -56,7 +56,7 @@ copyPropagation = flip evalState mempty . hyloM rmBlocks builder where
5656 put newEnv
5757 pure $ SBlockF rightExp
5858
59- -- rename lhs variables with their original aliases
59+ -- add the lhs value as an original value
6060 EBind (SReturn val) bpat@ (VarPat patVar) rightExp
6161 | isn't _Lit val
6262 , valWithOrigVars <- substNamesVal aliases val -> do
@@ -77,7 +77,7 @@ copyPropagation = flip evalState mempty . hyloM rmBlocks builder where
7777 put newEnv
7878 pure $ SBlockF rightExp
7979
80- -- rename lhs variables with their original aliases
80+ -- add the lhs value as an original value
8181 -- and eliminate redudant rebinds
8282 EBind (SReturn val) (AsPat patVar asPat) rightExp
8383 | isn't _Lit val
@@ -91,7 +91,7 @@ copyPropagation = flip evalState mempty . hyloM rmBlocks builder where
9191 put newEnv
9292 pure $ project $ EBind (SReturn val) (VarPat patVar) rightExp
9393
94- -- simplifying as-patterns matching against the same basic value they bind
94+ -- simplify as-pattern matching against the same basic value it binds
9595 EBind (SReturn retVal) (AsPat var patVal) rightExp
9696 | isBasicValue retVal
9797 , retVal == patVal -> do
@@ -100,7 +100,7 @@ copyPropagation = flip evalState mempty . hyloM rmBlocks builder where
100100 _ -> pure $ project exp'
101101
102102 -- NOTE: This cleans up the left-over produced by the above transformation.
103- -- It removes nested blocks, and blocks appearing on the left -hand side of a
103+ -- It removes nested blocks, and blocks appearing on the right -hand side of a
104104 -- binding. These are always safe to remove.
105105 rmBlocks :: ExpF Exp -> State Env Exp
106106 rmBlocks = \ case
0 commit comments