[GHC] #15760: Preserve parens in TH
GHC
ghc-devs at haskell.org
Wed Oct 17 14:16:51 UTC 2018
#15760: Preserve parens in TH
-------------------------------------+-------------------------------------
Reporter: goldfire | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Template | Version: 8.6.1
Haskell |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Template Haskell supports parentheses in its AST. So does GHC. Yet GHC
casually discards parentheses when desugaring TH quotes. We should
preserve them.
I was originally thinking that this could get rid of `Note [Adding parens
for splices]` in Convert, but that processing would still be necessary if
we are converting TH AST that did not come from a quote. Actually, it gets
worse with this change, because we don't want to add ''redundant'' parens.
Still, I think preserving parens is the right thing to do here. It also
makes it possible for a client to give special meaning to, say, nested
parens: Perhaps `process [| f x |]` and `process [| f ((x)) |]` will
behave differently. (Idiom brackets, anyone?)
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15760>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list