|
TH naming problem, different 'newName's clash: msg#00011lang.haskell.glasgow.bugs
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
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: ghc 6.2 gets confused about Main.hi reuse, Simon Marlow |
|---|---|
| Next by Date: | Re: ghc 6.2 gets confused about Main.hi reuse, Claus Reinke |
| Previous by Thread: | RE: ghc 6.2 gets confused about Main.hi reuse, Simon Marlow |
| Next by Thread: | [ ghc-Bugs-913728 ] Error in installation (fixed), SourceForge.net |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |