[GHC] #13054: Generating unique names with template haskell

GHC ghc-devs at haskell.org
Wed Jul 26 01:42:58 UTC 2017


#13054: Generating unique names with template haskell
-------------------------------------+-------------------------------------
        Reporter:  tim-m89           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Template Haskell  |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 I've given this some further thought, and my belief is that `newName`
 really can't be made to work well with top-level identifier names. After
 all, if you have two top-level foreign imports with the name `makeFun` and
 you try invoking `makeFun` somewhere, how is GHC supposed to tell the two
 `makeFun`s apart, even with different uniques? `newName` just doesn't work
 for that purpose.

 Now perhaps you don't care about having a foreign import with the exact
 name `makeFun`—you just want a unique top-level name that sorta kinda
 looks like `makeFun` (perhaps, say, `makeFun_4j121c4`). I think there is a
 valid need for such functionality, and in fact, I think Richard's
 `newUniqueName` provides more or less a blueprint for how one might
 actually implement it in GHC.

 I propose adapting the implementation to create a `newGlobalName` function
 for this purpose. Moreover, I propose we note the fact that `newName` is
 insufficient for top-level names in its Haddocks, and point to
 `newGlobalName` as an example of how you should do it.

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


More information about the ghc-tickets mailing list