summaryrefslogtreecommitdiff
path: root/compiler/coreSyn
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2012-08-15 14:23:42 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2012-08-15 14:23:42 +0100
commitaf9dd9d3ed1b3d1f1dd9a44f567a2559fa669f1b (patch)
tree3403c74f16c9b2ea0e4b8e53e946c82d8d2dd6a6 /compiler/coreSyn
parent1993ee4ba8d30d6774c2330477a1eecf865dfa1f (diff)
downloadhaskell-af9dd9d3ed1b3d1f1dd9a44f567a2559fa669f1b.tar.gz
Comments about shadowing
Diffstat (limited to 'compiler/coreSyn')
-rw-r--r--compiler/coreSyn/CoreSyn.lhs13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/coreSyn/CoreSyn.lhs b/compiler/coreSyn/CoreSyn.lhs
index a84a29a6c0..8ccece0a16 100644
--- a/compiler/coreSyn/CoreSyn.lhs
+++ b/compiler/coreSyn/CoreSyn.lhs
@@ -299,6 +299,19 @@ data Bind b = NonRec b (Expr b)
deriving (Data, Typeable)
\end{code}
+Note [Shadowing]
+~~~~~~~~~~~~~~~~
+While various passes attempt to rename on-the-fly in a manner that
+avoids "shadowing" (thereby simplifying downstream optimizations),
+neither the simplifier nor any other pass GUARANTEES that shadowing is
+avoided. Thus, all passes SHOULD work fine even in the presence of
+arbitrary shadowing in their inputs.
+
+In particular, scrutinee variables `x` in expressions of the form
+`Case e x t` are often renamed to variables with a prefix
+"wild_". These "wild" variables may appear in the body of the
+case-expression, and further, may be shadowed within the body.
+
Note [Literal alternatives]
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Literal alternatives (LitAlt lit) are always for *un-lifted* literals.