[GHC] #10331: Accept HsSyn in splices and generate it in quotes (ghc-api)
GHC
ghc-devs at haskell.org
Mon Apr 20 15:11:50 UTC 2015
#10331: Accept HsSyn in splices and generate it in quotes (ghc-api)
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: feature | Status: new
request | Milestone:
Priority: low | Version: 7.11
Component: Template | Operating System: Unknown/Multiple
Haskell | Type of failure: None/Unknown
Keywords: | Blocked By:
Architecture: | Related Tickets:
Unknown/Multiple |
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
I propose a language pragma `GhcTemplateHaskell`, which, when enabled,
causes Template Haskell splices to accept `HsSyn` return values, and
causes TH quotes to return `HsSyn` trees. Users of `GhcTemplateHaskell`
would stop using the `template-haskell` library and just directly
manipulate the frontend ASTs using the `ghc-api`.
Given our ghc-api track record, you would probably not be able to write
code using this without having it break every GHC release. However,
clients who are willing to track GHC development would reap the following
benefits:
1. All syntax in Haskell would be supported in quotes; the AST would never
lag behind. Additionally, you could use the ghc-api parser to parse
Haskell code to be returned in a splice. (#2041)
2. Locations from quoting would be preserved. (Problem 2 of #10330)
I don't think this would be difficult to implement, but it definitely
could be a ball of wax. I broke this proposal off from #2041.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10331>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list