[GHC] #10595: BuiltinRules override other rules in some cases.

GHC ghc-devs at haskell.org
Wed Jul 1 23:04:12 UTC 2015


#10595: BuiltinRules override other rules in some cases.
-------------------------------------+-------------------------------------
              Reporter:  gjsimms     |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  high        |         Milestone:
             Component:  Compiler    |           Version:  7.10.1
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 It seems that the Class op * rules will override a user defined rule for
 class functions.

 This seems to be a long outstanding issue:
 http://stackoverflow.com/questions/9811294/rewrite-rules-not-firing-for-
 rules-matching-multiple-instance-methods

 I also just ran into someone else on the haskell IRC channel who had an
 even simpler example then the one on that page:
 {{{#!hs
 {-# NOINLINE d #-}
 {-# RULES "d exp" d exp = exp #-}
 d :: (Double -> Double) -> (Double -> Double)
 d f = f . (+20.0)

 g :: Double -> Double
 g = (+5.0)

 main = do
   print $ d exp 1.0     -- FAIL should print 2.718281828459045  >>
 printed exp 21.0 instead
   print $ d g 3.0       -- PASS should print 28.0

 -- Compiled with:
 --   ghc -fenable-rewrite-rules -O rules.hs
 }}}

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


More information about the ghc-tickets mailing list