Confusing printing of unsaturated primops in RULE firings
I have
{-# LANGUAGE MagicHash #-}
module Main where
import GHC.Exts
five = I# (2# +# 3#)
{-# RULES "funky" (+#) = (*#) #-}
main :: IO ()
main = print five
When I ghc -O Scratch.hs -main-is Scratch -fforce-recomp -ddump-rule-rewrites
, I get
Loaded package environment from /Users/rae/.ghc/x86_64-darwin-8.10.1/environments/default
[1 of 1] Compiling Scratch ( Scratch.hs, Scratch.o, Scratch.dyn_o )
Rule fired
Rule: funky
Module: (Scratch)
Before: GHC.Prim.+# ValArg 2# ValArg 3#
After: GHC.Prim.*#
Cont: Stop[BoringCtxt] GHC.Prim.Int#
Rule fired
Rule: *#
Module: (BUILTIN)
Before: GHC.Prim.*# ValArg 2# ValArg 3#
After: 6#
Cont: Stop[BoringCtxt] GHC.Prim.Int#
Rule fired
Rule: Class op show
Module: (BUILTIN)
Before: GHC.Show.show TyArg GHC.Types.Int ValArg GHC.Show.$fShowInt
After: GHC.Show.$fShowInt_$cshow
Cont: ApplyToVal nodup x_aN7
Stop[BoringCtxt] GHC.Base.String
Linking Scratch ...
ld: warning: directory not found for option '-L/opt/local/lib/'
ld: warning: text-based stub file /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.tbd and library file /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.dylib are out of sync. Falling back to library file for linking.
rae:14:29:21 ~/temp>
Note the first rule rewrite. It says
Before: GHC.Prim.+# ValArg 2# ValArg 3#
After: GHC.Prim.*#
Eek! At first, I thought we were bound for a core-lint error. Actually, all is well: it's just a printing problem. But I was thrown off the scent of some other misbehavior by this one.