[Template-haskell] RE: mkName and qualified names

Simon Peyton-Jones simonpj at microsoft.com
Tue Apr 6 14:12:11 EDT 2004


Template Haskell folk

I've fixed several bugs in Template Haskell, and made minor changes as
follows

* Two bugs reported by Duncan Coutts
    - do {d <- runQ $ [| let foo = bar where bar = 3 in foo |];  print
d}
	used to panic
    - using newName "foo" twice gave rise to duplicate-binding warning

* Make Language.Haskell.TH export dyn :: String -> ExpQ, as advertised
in "note2"

* Give an explicit export list to Language.Haskell.TH, so that it no
longer exposes
   random helper functions from inside TH.Lib, say.  I may have
inadvertently hidden
   something useful, so please yell if so

* Arrange that mkName (and hence dyn) understand qualified names. So
	dyn "Maybe.isJust"
   will now generate the qualified name, as you might expect.

All of this in the HEAD only, of course.

Keep pinging if there are bugs you trip over.  And what is the top
priority for
improvement?

Simon

| -----Original Message-----
| From: George Russell [mailto:ger at informatik.uni-bremen.de]
| Sent: 02 April 2004 10:12
| To: Simon Peyton-Jones
| Subject: Re: mkName and qualified names
| 
| Simon Peyton-Jones wrote:
| > 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)
| 
| Don't you bind a qualified name in a record or class declaration
sometimes,
| for example
|     x = M.A {M.b = True}
| or
|     instance M.A B where
|        M.c = True
| 
| Or is that something different?
| 
| just checking,
| 
| George


More information about the template-haskell mailing list