#7374: rule not firing
---------------------------------+------------------------------------------
    Reporter:  igloo             |       Owner:                  
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:  7.8.1           
   Component:  Compiler          |     Version:  7.6.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
 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)
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7374>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to