[GHC] #11593: Template Haskell: Add a way to get names that are neither capturable nor capturing.

GHC ghc-devs at haskell.org
Wed Feb 17 17:59:40 UTC 2016


#11593: Template Haskell: Add a way to get names that are neither capturable nor
capturing.
-------------------------------------+-------------------------------------
           Reporter:  cgibbard       |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Template       |           Version:  7.10.3
  Haskell                            |
           Keywords:                 |  Operating System:  Unknown/Multiple
  yhjulwwiefzojcbxybbruweejw         |
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 From the documentation on newName: "Although names generated by newName
 cannot ''be captured'', they can ''capture'' other names."

 We recently ran into a case where we'd really have liked a way to create a
 name which can't interact at all with other names in the code, apart from
 where it is used in the construction of the TH expression.

 In this code:

 https://github.com/reflex-frp/reflex/blob/develop/src/Reflex/Dynamic/TH.hs

 The `newName "dynamicQuotedExpressionVariable"` used to be simply `newName
 "dyn"`, and we ended up having occurrences of `dyn` in the quasiquoted
 expressions (which would be constructed by NameG) get captured by that
 newName rather than referring to reflex-dom's definition of `dyn`.

 There ought to be some Q Name action which can be executed to give fresh
 names which can be used internally by a TH macro without fear that they
 can be referred to in any way other than using the Name value obtained
 from the action. The documentation for `Name` seems to suggest that
 newName is presently the closest thing, so perhaps we need a new primitive
 for creating totally-non-interacting Names.

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


More information about the ghc-tickets mailing list