Good point.  I've fixed this in the HEAD.  Thanks for identifying it.

Simon

| -----Original Message-----
| From: [EMAIL PROTECTED]
[mailto:glasgow-haskell-bugs-
| [EMAIL PROTECTED] On Behalf Of Duncan Coutts
| Sent: 08 March 2004 15:07
| To: [EMAIL PROTECTED]
| Subject: TH naming problem, different 'newName's clash
| 
| 
| I'm using the new abstract names of TH2 in ghc 6.3 (CVS early March)
| 
| I'm generating code that looks like this:
| 
| let foo_1 = e1
|     foo_2 = e2
|  in e3
| 
| I'm using
| name <- newName "foo"
| to generate these names (foo_1, foo_2 etc) however when I splice this
| code in ghc complains as if I'd written
| 
| let foo = e1
|     foo = e2
|  in e3
| 
| ie that I have multiple definitions of the same variable in the same
let
| block.
| 
| So, to be precise:
| 
| foo :: ExpQ
| foo = do
|   foo1 <- newName "foo"
|   foo2 <- newName "foo"
|   letE [valD (varP foo1) (normalB [| 3 |]) []
|        ,valD (varP foo2) (normalB [| 4 |]) []]
|        [| 5 |]
| 
| If we print this, it looks like what we want:
| > do {e <- runQ foo; print (pprExp 0 e)}
| let foo_0 = 3
|     foo_1 = 4
|  in 5
| 
| but if we ask about $(foo), ghc tells us:
| 
|     Conflicting definitions for `foo'
|     In the binding group for: foo, foo
| 
| It looks like the unique identifiers on the local names are being
| forgotten when we splice in.
| 
| I can work around this for the moment using something like
| mkName ("foo_" ++ show somethingUnique)
| but it's not nice.
| 
| Duncan
| 
| _______________________________________________
| Glasgow-haskell-bugs mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to