Skip to content

rule not firing

In the code below, the rule appears not to fire.

Based on the bytestring rules, reported as broken here: http://www.haskell.org/pipermail/glasgow-haskell-users/2012-August/022775.html

ghc -O --make h.hs -ddump-simpl -fforce-recomp -Wall
module Q (f) where

{-# NOINLINE f #-}
f :: Bool -> String
f c = g ((==) c)

{-# NOINLINE g #-}
g :: (Bool -> Bool) -> String
g _ = "g"

h :: Bool -> String
h _ = "h"

{-# RULES "MyRule" forall x . g ((==) x) = h x #-}
==================== Tidy Core ====================
Result size of Tidy Core = {terms: 25, types: 21, coercions: 0}

lvl_rkK :: GHC.Types.Char
[GblId, Caf=NoCafRefs, Str=DmdType m]
lvl_rkK = GHC.Types.C# 'h'

lvl1_rkL :: [GHC.Types.Char]
[GblId, Caf=NoCafRefs, Str=DmdType]
lvl1_rkL =
  GHC.Types.:
    @ GHC.Types.Char lvl_rkK (GHC.Types.[] @ GHC.Types.Char)

h_reA :: GHC.Types.Bool -> GHC.Base.String
[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType A]
h_reA = \ _ -> lvl1_rkL

lvl2_rkM :: GHC.Types.Char
[GblId, Caf=NoCafRefs, Str=DmdType m]
lvl2_rkM = GHC.Types.C# 'g'

lvl3_rkN :: [GHC.Types.Char]
[GblId, Caf=NoCafRefs, Str=DmdType]
lvl3_rkN =
  GHC.Types.:
    @ GHC.Types.Char lvl2_rkM (GHC.Types.[] @ GHC.Types.Char)

g_rez :: (GHC.Types.Bool -> GHC.Types.Bool) -> GHC.Base.String
[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType A]
g_rez = \ _ -> lvl3_rkN

Q.f [InlPrag=NOINLINE] :: GHC.Types.Bool -> GHC.Base.String
[GblId, Arity=1, Caf=NoCafRefs, Str=DmdType A]
Q.f =
  \ (c_aeC :: GHC.Types.Bool) ->
    g_rez (GHC.Classes.$fEqBool_$c== c_aeC)
Trac metadata
Trac field Value
Version 7.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information