[GHC] #7398: RULES don't apply to a newtype constructor

GHC ghc-devs at haskell.org
Mon Nov 24 21:58:27 UTC 2014


#7398: RULES don't apply to a newtype constructor
-------------------------------------+-------------------------------------
              Reporter:  shachaf     |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:  7.10.1
             Component:  Compiler    |          Version:  7.6.1
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:  Incorrect   |       Blocked By:
  result at runtime                  |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by thomie):

 GHC 7.8.3 now shows two warnings:
 {{{
 $ ghc-7.8.3 -fforce-recomp -O2 D.hs
 [1 of 1] Compiling Main             ( D.hs, D.o )

 D.hs:9:11: Warning:
     Rule "rule Foo" may never fire
       because ‘Main.Foo’ might inline first
     Probable fix: add an INLINE[n] or NOINLINE[n] pragma on ‘Main.Foo’

 D.hs:10:11: Warning:
     Rule "rule foo" may never fire because ‘foo’ might inline first
     Probable fix: add an INLINE[n] or NOINLINE[n] pragma on ‘foo’
 Linking D ...
 }}}

 GHC HEAD shows a different warning:
 {{{
 $ ghc-7.9.20141121 -O2 -fforce-recomp D.hs
 [1 of 1] Compiling Main             ( D.hs, D.o )

 D.hs:9:11: Warning:
     RULE left-hand side too complicated to desugar
       Optimised lhs: v
                      `cast` (Sym (Main.NTCo:Foo[0] <a>_R) :: a ~R# Foo a)
       Orig lhs: Main.Foo @ a v

 D.hs:10:11: Warning:
     Rule "rule foo" may never fire because ‘foo’ might inline first
     Probable fix: add an INLINE[n] or NOINLINE[n] pragma on ‘foo’
 }}}

 If the warning `RULE left-hand side too complicated to desugar` is
 correct, we should add a test for it (there currently aren't any).

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


More information about the ghc-tickets mailing list