[GHC] #15760: Preserve parens in TH

#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

#15760: Preserve parens in TH -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 8.6.1 Resolution: | Keywords: 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 RyanGlScott): That sounds like a reasonable enough desire. Where are you applying this fix? In `DsMeta`? If so, please make sure that the functions in `Convert` don't accidentally add extraneous parentheses (I've tried quite hard to ensure that `Convert` only adds required parentheses if they're missing, but it's quite possible that I've missed a case). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15760#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15760: Preserve parens in TH -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15815 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #15815 Comment: See #15815 for a notable example of a bug that this issue causes. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15760#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15760: Preserve parens in TH -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15815 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by int-e): * cc: int-e (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15760#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15760: Preserve parens in TH -------------------------------------+------------------------------------- Reporter: goldfire | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Template Haskell | Version: 8.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #15815, #15824 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by int-index): * related: #15815 => #15815, #15824 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15760#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC