[Template-haskell] RE: mkName and qualified names
Simon Peyton-Jones
simonpj at microsoft.com
Fri Apr 2 09:03:24 EST 2004
Ah, indeed so. Apologies.
The constructor Var is actually called VarE.
And "dyn" should be defined but isn't. I was wrong to say the mkName
won't do the job -- it will. But as you found, it doesn't work for
qualified names. It probably should. (Or maybe "dyn" should but mkName
should not, because dyn is only used for *occurrences* whereas mkName
makes a name that you can use for binding too. It wouldn't make sense
to say
let n = mkName "A.x" in LamE (VarP n) (VarE n)
)
So that's something I should fix. But meanwhile, the unqualified
version works just fine
mkTyConApp2 = $( varE . mkName $ "mkTyConApp" )
Simon
| -----Original Message-----
| From: George Russell [mailto:ger at informatik.uni-bremen.de]
| Sent: 01 April 2004 16:03
| To: George Russell
| Cc: Simon Peyton-Jones
| Subject: Re: mkName and qualified names
|
| George Russell wrote:
| > Simon Peyton-Jones wrote:
| >
| >> If you read "Notes about TH v2" you'll see that if you want
something
| >> that is *not* lexically scoped, you can use
| >> $(dyn "x")
| >> inside quotes. Section 4.4 dicssusses
| >
| >
| > "dyn" doesn't seem to be exported by Language.Haskell.TH in the HEAD
| > version.
|
| ...
|
| and while "Notes about TH v2" defines "dyn s = return (Var (mkName
s))",
| I can't do that because Language.Haskell.TH in the HEAD version
doesn't
| export Var either. I did use "varE" in my original example.
|
| best wishes,
|
| George
More information about the template-haskell
mailing list