diff options
| author | simonpj@microsoft.com <unknown> | 2010-11-26 16:24:09 +0000 |
|---|---|---|
| committer | simonpj@microsoft.com <unknown> | 2010-11-26 16:24:09 +0000 |
| commit | e24638cf715a67d087cac3d6a8d979f76f957c62 (patch) | |
| tree | 9abf3b83d89ef8f18dcdcf5fcfa5cbab7699c470 | |
| parent | 491b818a4a9bd2160107178499e160d62933f58c (diff) | |
| download | haskell-e24638cf715a67d087cac3d6a8d979f76f957c62.tar.gz | |
Acutally, wild-card variables *can* have occurrences
This patch removes the Lint test, and comments why
| -rw-r--r-- | compiler/coreSyn/CoreLint.lhs | 4 | ||||
| -rw-r--r-- | compiler/simplCore/SimplEnv.lhs | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/compiler/coreSyn/CoreLint.lhs b/compiler/coreSyn/CoreLint.lhs index 428cda8dec..5cc82a2ae2 100644 --- a/compiler/coreSyn/CoreLint.lhs +++ b/compiler/coreSyn/CoreLint.lhs @@ -227,10 +227,6 @@ lintCoreExpr (Var var) = do { checkL (not (var == oneTupleDataConId)) (ptext (sLit "Illegal one-tuple")) - ; checkL (not (var `hasKey` wildCardKey)) - (ptext (sLit "Occurence of a wild-card binder") <+> ppr var) - -- See Note [WildCard binders] in SimplEnv - ; checkDeadIdOcc var ; var' <- lookupIdInScope var ; return (idType var') } diff --git a/compiler/simplCore/SimplEnv.lhs b/compiler/simplCore/SimplEnv.lhs index 896fe97626..d9eea39ed6 100644 --- a/compiler/simplCore/SimplEnv.lhs +++ b/compiler/simplCore/SimplEnv.lhs @@ -240,11 +240,18 @@ Note [WildCard binders] The program to be simplified may have wild binders case e of wild { p -> ... } We want to *rename* them away, so that there are no -occurrences of 'wild' (with wildCardKey). The easy +occurrences of 'wild-id' (with wildCardKey). The easy way to do that is to start of with a representative Id in the in-scope set -There should be no *occurrences* of wild. +There can be be *occurrences* of wild-id. For example, +MkCore.mkCoreApp transforms + e (a /# b) --> case (a /# b) of wild { DEFAULT -> e wild } +This is ok provided 'wild' isn't free in 'e', and that's the delicate +thing. Generally, you want to run the simplifier to get rid of the +wild-ids before doing much else. + +It's a very dark corner of GHC. Maybe it should be cleaned up. \begin{code} getMode :: SimplEnv -> SimplifierMode |
