Template Haskell: Add a way to get names that are neither capturable nor capturing.
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.
Trac metadata
Trac field | Value |
---|---|
Version | 7.10.3 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | cgibbard@gmail.com |
Operating system | |
Architecture |