[GHC] #10599: Template Haskell doesn't allow `newName "type"`

GHC ghc-devs at haskell.org
Fri Jul 3 03:41:08 UTC 2015


#10599: Template Haskell doesn't allow `newName "type"`
-------------------------------------+-------------------------------------
        Reporter:  meteficha         |                   Owner:  goldfire
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:  7.12.1
       Component:  Template Haskell  |                 Version:  7.10.2-rc2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Changes (by goldfire):

 * owner:   => goldfire
 * milestone:   => 7.12.1


Comment:

 Interesting. Part of the confusion here is that names generated by
 `newName` are different from other names you can use in Haskell. So when
 you say `newName "type"`, the variable's name really is `type`, but
 because it comes from `newName`, GHC prints it specially, as it's
 '''different''' from any other variable named `type`. So what you're
 trying to do -- create a variable named `type` -- is objectionable. It's
 just that the pretty-printer makes it look more sensible.

 On the other hand, there is no reason at all for TH to be picky about
 `newName` names. GHC got pickier about TH names between 7.8 and 7.10
 because 7.8 allowed non-`newName` names that aren't allowed in Haskell,
 making variables that can't be referred to outside of TH. However, with
 `newName`, the whole point is that you can't refer to them outside of TH.
 So I think an improvement would be just to let `newName` be very liberal
 in what it accepts.

 As I'm inclined to say that GHC is doing the Right Thing here (that is,
 rejecting a variable named `type`), it seems most sensible to wait until
 7.12 to fix. But if this is ruining your day, speak up. I don't feel very
 strongly on this point, at all.

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


More information about the ghc-tickets mailing list