[GHC] #12778: Expose variables bound in quotations to reify
GHC
ghc-devs at haskell.org
Tue Jun 6 13:15:03 UTC 2017
#12778: Expose variables bound in quotations to reify
-------------------------------------+-------------------------------------
Reporter: | Owner: (none)
facundo.dominguez |
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Template Haskell | Version: 8.0.1
Resolution: | Keywords: template-
| haskell reify
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D3003
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by facundo.dominguez):
Another way to address this. We make
{{{
$([| let x = True in $(q) |])
}}}
desugar to
{{{
$(return (LetE [ x = True ] (Splice q)))
}}}
where `Splice :: Q Exp -> Exp` is a new constructor of the datatype
`Language.Haskell.TH.Syntax.Exp`.
The compiler runs first the outer splice which becomes
{{{
let x = True in $(q)
}}}
and then it runs the inner splice $(q) as if it were a regular top-level
splice.
Pros: It makes inner splices work pretty much as outer splices.
Cons: This probably is a bigger change in the compiler (hopefully not too
big).
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12778#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list