Cross-stage persistence using untyped type quotations
In a similar theme to my other tickets about typed TemplateHaskell I noticed today that cross-stage persistence for type variables, in type quotations is also not considered at all.
In this quote, a
is clearly bound in the type of baz
.
baz :: forall a . Q Type
baz = [t| a |]
The correct behaviour is that the value a
inside the quotation should be substituted for whatever a
is instantiated to at the application of baz
or a failure that a
is out of scope. The actual error happens when the splice is run.
TH_Run.hs:10:15: error:
• The exact Name ‘a’ is not in scope
Probable cause: you used a unique Template Haskell name (NameU),
perhaps via newName, but did not bind it
If that's it, then -ddump-splices might be useful
• In the untyped splice: $baz
|
10 | print () :: $baz
| ^^^^