[Haskell-cafe] parametrized data types and Template Haskell
adam vogt
vogt.adam at gmail.com
Mon Dec 30 18:55:53 UTC 2013
On Mon, Dec 30, 2013 at 12:08 PM, Maarten Faddegon
<haskell-cafe at maartenfaddegon.nl> wrote:
> Did I find a bug in ghc's Template Haskell implementation or am I doing
> something silly?
Hi Maarten,
If you look at the definition of Name, you will see several
NameFlavours. In your case your `a' has a NameU (unique). I think if
you had the type variable names tagged with a NameS (simple?), ghc
would accept your code.
Somewhat related is a case where ghc accepts NameU as a NameS when no
other variables in scope could conflict:
x1 = [d| x = 1 |]
is short for:
x1 = return [ValD (VarP x_1627406778) (NormalB (LitE (IntegerL 1))) []]
but when you splice x1, "x" is bound, instead of the unique,
difficult-to-reference variable x_1627406778.
Regards,
Adam Vogt
More information about the Haskell-Cafe
mailing list