[GHC] #15550: Names of RULES aren't quoted in -ddump-splices

GHC ghc-devs at haskell.org
Tue Aug 21 14:34:37 UTC 2018


#15550: Names of RULES aren't quoted in -ddump-splices
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Template       |           Version:  8.4.3
  Haskell                            |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Compile the following program:

 {{{#!hs
 {-# LANGUAGE TemplateHaskell #-}
 {-# OPTIONS_GHC -ddump-splices #-}
 module Bug where

 $([d| myId :: a -> a
       myId x = x
       {-# NOINLINE [1] myId #-}
       {-# RULES "myId" forall x. myId x = x #-}
     |])
 }}}
 {{{
 $ /opt/ghc/8.4.3/bin/ghci Bug.hs
 GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/ryanglscott/.ghci
 [1 of 1] Compiling Bug              ( Bug.hs, interpreted )
 Bug.hs:(5,3)-(9,6): Splicing declarations
     [d| {-# RULES "myId" forall x_a1xu. myId_a1xr x_a1xu = x_a1xu #-}

         myId_a1xr :: a_a1xs -> a_a1xs
         myId_a1xr x_a1xt = x_a1xt
         {-# NOINLINE [1] myId_a1xr #-} |]
   ======>
     myId_a49f :: a_a49e -> a_a49e
     myId_a49f x_a49g = x_a49g
     {-# NOINLINE [1] myId_a49f #-}
     {-# RULES myId forall x_a49h. myId_a49f x_a49h = x_a49h #-}
 Ok, one module loaded.
 }}}

 Notice how in the bottom of the `-ddump-splices` output, the name of the
 rewrite rule for `myId` isn't surrounded by double quotes, thus making it
 syntactically invalid. That is, it's printed as:

 {{{#!hs
 {-# RULES myId forall x_a49h. myId_a49f x_a49h = x_a49h #-}
 }}}

 Whereas it should be:

 {{{#!hs
 {-# RULES "myId" forall x_a49h. myId_a49f x_a49h = x_a49h #-}
 }}}

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


More information about the ghc-tickets mailing list