X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fspecialise%2FRules.lhs;h=000df944cfcc1907447b9fcc7ebb63a73a74b671;hb=9367b24fde0c3f5efa5934e69571f5834ed43548;hp=65975f81cb537372135332c1b567c558775ff8a7;hpb=df62fe193785e1fc9786a6c7321670f99fa9a37d;p=ghc-hetmet.git diff --git a/compiler/specialise/Rules.lhs b/compiler/specialise/Rules.lhs index 65975f8..000df94 100644 --- a/compiler/specialise/Rules.lhs +++ b/compiler/specialise/Rules.lhs @@ -123,11 +123,13 @@ ruleCantMatch :: [Maybe Name] -> [Maybe Name] -> Bool -- It's only a one-way match; unlike instance matching we -- don't consider unification -- --- Notice that there is no case --- ruleCantMatch (Just n1 : ts) (Nothing : as) = True --- Reason: a local variable 'v' in the actuals might --- have an unfolding which is a global. --- This quite often happens with case scrutinees. +-- Notice that [_$_] +-- ruleCantMatch [Nothing] [Just n2] = False +-- Reason: a template variable can be instantiated by a constant +-- Also: +-- ruleCantMatch [Just n1] [Nothing] = False +-- Reason: a local variable 'v' in the actuals might [_$_] + ruleCantMatch (Just n1 : ts) (Just n2 : as) = n1 /= n2 || ruleCantMatch ts as ruleCantMatch (t : ts) (a : as) = ruleCantMatch ts as ruleCantMatch ts as = False @@ -273,10 +275,10 @@ findBest target (rule1,ans1) ((rule2,ans2):prs) | otherwise = doubleQuotes (ftext (ru_name rule)) in pprTrace "Rules.findBest: rule overlap (Rule 1 wins)" (vcat [if opt_PprStyle_Debug then - ptext SLIT("Expression to match:") <+> ppr fn <+> sep (map ppr args) + ptext (sLit "Expression to match:") <+> ppr fn <+> sep (map ppr args) else empty, - ptext SLIT("Rule 1:") <+> pp_rule rule1, - ptext SLIT("Rule 2:") <+> pp_rule rule2]) $ + ptext (sLit "Rule 1:") <+> pp_rule rule1, + ptext (sLit "Rule 2:") <+> pp_rule rule2]) $ findBest target (rule1,ans1) prs | otherwise = findBest target (rule1,ans1) prs where @@ -830,9 +832,9 @@ ruleAppCheck_help phase fn args rules check_rule rule = rule_herald rule <> colon <+> rule_info rule rule_herald (BuiltinRule { ru_name = name }) - = ptext SLIT("Builtin rule") <+> doubleQuotes (ftext name) + = ptext (sLit "Builtin rule") <+> doubleQuotes (ftext name) rule_herald (Rule { ru_name = name }) - = ptext SLIT("Rule") <+> doubleQuotes (ftext name) + = ptext (sLit "Rule") <+> doubleQuotes (ftext name) rule_info rule | Just _ <- matchRule noBlackList emptyInScopeSet args rough_args rule