Skip to content

`++` RULE overlapp

With a debugged GHC I see quite a few messages like:

Rules.findBest: rule overlap (Rule 1 wins)
  Rule 1: "++"
  Rule 2: "++/literal"

The rules in question are:

{-# RULES
"++/literal"      forall x. (++) (unpackCString# x)     = unpackAppendCString# x
"++/literal_utf8" forall x. (++) (unpackCStringUtf8# x) = unpackAppendCStringUtf8# x #-}

{-# RULES
"++"    [~1] forall xs ys. xs ++ ys = augment (\c n -> foldr c n xs) ys
  #-}

At a glance I would assume it would be better for ++/literal to fire as it seems more specific.

However currently RULE ++ fires. I assume since it covers more of the arguments to ++.

Either way I haven't looked into it any further. @hsyl20 might know more since he added the ++/literal rule.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information