
#12778: Expose variables bound in quotations to reify -------------------------------------+------------------------------------- Reporter: | Owner: facundo.dominguez | Type: bug | Status: new 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): Wiki Page: | -------------------------------------+------------------------------------- Comment (by facundo.dominguez): The proposal is incomplete. For it to work, we would need to extend `Exp`, `Pat` and `Type` with constructors mimicking what `HsSpliced` does in the GHC AST. This is ok for producing code with splices inside brackets, but what about pattern mathing `Exp` values? To be comprehensive of all cases, the following code {{{ case e of TupE [LitE _, LitE _] -> ... _ -> ... }}} would need to be rewritten {{{ case e of TupE [ LitE _, LitE _] -> ... TupE [ LitE _, SplicedE _ (LitE _)] -> ... TupE [SplicedE _ (LitE _), LitE _] -> ... TupE [SplicedE _ (LitE _), SplicedE _ (LitE _)] -> ... _ -> ... }}} It could be alleviated with view patterns like {{{ case e of TupE [ dropSplicedE -> (LitE _), dropSplicedE -> (LitE _)] -> ... _ -> ... where dropSplicedE (SplicedE _ e) = e dropSplicedE e = e }}} but is it tolerable? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12778#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler