Template Haskell fails when quoting an out-of-scope SPECIALISE
If I say
$( do ty <- [d| {-# SPECIALISE x :: Int #-} |]
TH.runIO $ print ty
return [] )
then I see
• Not in scope: ‘x’
• In the Template Haskell quotation
[d| {-# SPECIALISE x :: Int #-} |]
This surprises me, as x
does not need to be in scope to be able to desugar this quotation. Like we do elsewhere, we should just make x
a capturable identifier.
To be clear, this is not ruining my day. I just came across it in other work and was surprised. Happy for this to be low priority.