
#10331: Accept HsSyn in splices and generate it in quotes (ghc-api) -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Template Haskell | Version: 7.11 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by goldfire): I propose a slightly different direction: parameterize TH over the choice of AST. Something like {{{ class ExpAST e where repExp :: LHsExpr Name -> DsM (Core (TH.Q e)) cvExp :: e -> CvtM (LHsExpr RdrName) }}} Then, we define instances `ExpAST (LHsExpr Name)` and `ExpAST TH.Exp`. Perhaps the haskell-src-exts folks can define their own instance, too, if they so choose. I haven't thought this through, so apologies if this is a terrible idea. While we're moving in this direction, it might be nice to expose `TcM` to clients of TH. I know various terrible things could be done with the power of `TcM`, but nice things can, too. (In particular, I've wanted to be able to expand closed type families from TH code. I've implemented that functionality once [in GHC], and I dearly don't want to do it again! Exposing `TcM` would allow me to start thinking about how to do this.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10331#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler