X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FdeSugar%2FDsExpr.lhs;h=a58e9b4b892b8fcb5def528fa338874413f6fbb3;hb=4573fe62a3672b8668ddd4705d770540b10e6e81;hp=d8bd7cdeeae27ed309bb45f15fc446877c9d7163;hpb=eeef817a869bdbfa8820608be081f133dad71071;p=ghc-hetmet.git diff --git a/compiler/deSugar/DsExpr.lhs b/compiler/deSugar/DsExpr.lhs index d8bd7cd..a58e9b4 100644 --- a/compiler/deSugar/DsExpr.lhs +++ b/compiler/deSugar/DsExpr.lhs @@ -643,6 +643,9 @@ Example: the foldr/single rule in GHC.Base foldr k z [x] = ... We do not want to generate a build invocation on the LHS of this RULE! +We fix this by disabling rules in rule LHSs, and testing that +flag here; see Note [Desugaring RULE left hand sides] in Desugar + To test this I've added a (static) flag -fsimple-list-literals, which makes all list literals be generated via the simple route. @@ -657,6 +660,7 @@ dsExplicitList elt_ty xs ; if opt_SimpleListLiterals -- -fsimple-list-literals || not (dopt Opt_EnableRewriteRules dflags) -- Rewrite rules off -- Don't generate a build if there are no rules to eliminate it! + -- See Note [Desugaring RULE left hand sides] in Desugar || null dynamic_prefix -- Avoid build (\c n. foldr c n xs)! then return $ mkListExpr elt_ty xs' else mkBuildExpr elt_ty (mkSplitExplicitList dynamic_prefix static_suffix) }