Names of RULES aren't quoted in -ddump-splices
Compile the following program:
{-# 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:
{-# RULES myId forall x_a49h. myId_a49f x_a49h = x_a49h #-}
Whereas it should be:
{-# RULES "myId" forall x_a49h. myId_a49f x_a49h = x_a49h #-}
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.4.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Template Haskell |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |