[GHC] #13841: ADOPT pragma for silencing orphan instances warnings per instance

#13841: ADOPT pragma for silencing orphan instances warnings per instance -------------------------------------+------------------------------------- Reporter: cocreature | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.3 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: -------------------------------------+------------------------------------- Currently GHC only allows enabling and disabling the warnings about orphan instances on a module level. I’d like to have an ADOPT pragma that allows disabling the warning for specific instance: {{{#!haskell instance {-# ADOPT #-} C Int }}} Apart from disabling the warning about orphan instances for this specific instance, this pragma should have no effect. I already hacked together a [https://github.com/cocreature/ghc/tree/adopt- pragma prototype] and I’m willing to clean that up and submit a diff if other people like this. This does change the surface language but disabling a warning seem too small of an effect for the ghc proposals process (I’m happy to make a proposal if you disagree). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13841 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13841: ADOPT pragma for silencing orphan instances warnings per instance -------------------------------------+------------------------------------- Reporter: cocreature | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 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 simonpj): That would be OK by me. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13841#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13841: ADOPT pragma for silencing orphan instances warnings per instance -------------------------------------+------------------------------------- Reporter: cocreature | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #602, #10150 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * related: => #602, #10150 Comment: (See also #10150, which is essentially the same thing as this ticket.) Let me offer a dissenting opinion. I don't think we should be introducing tailor-made pragmas to suppress certain warnings like this. If we are in the business of suppressing warnings, we really should have a general mechanism that could work for //any// warning by delimiting regions of code that should have the warning disabled (the subject of #602). IMO, anything less than this is asking for trouble down the road. Moreover, I'm not a fan of changing the syntax of instances themselves just for the purposes of warning generation. We already have at least one pragma you can put in the same position, so now this would lead to pragma noise like: {{{#!hs instance {-# OVERLAPPING #-} {-# ADOPT #-} C T }}} In addition, we'd have to update the GHC and Template Haskell ASTs to support this, and I don't think what this buys us is worth the cost. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13841#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13841: ADOPT pragma for silencing orphan instances warnings per instance -------------------------------------+------------------------------------- Reporter: cocreature | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #602, #10150 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj):
If we are in the business of suppressing warnings, we really should have a general mechanism that could work for any warning by delimiting regions of code that should have the warning disabled
There is much to be said for that, thank you. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13841#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Let me offer a dissenting opinion. I don't think we should be introducing tailor-made pragmas to suppress certain warnings like this. If we are in the business of suppressing warnings, we really should have a general mechanism that could work for //any// warning by delimiting regions of code that should have the warning disabled (the subject of #602). IMO, anything less than this is asking for trouble down the road.
Moreover, I'm not a fan of changing the syntax of instances themselves just for the purposes of warning generation. We already have at least one
#13841: ADOPT pragma for silencing orphan instances warnings per instance -------------------------------------+------------------------------------- Reporter: cocreature | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: wontfix | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #602, #10150 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by cocreature): * status: new => closed * resolution: => wontfix Comment: Replying to [comment:2 RyanGlScott]: pragma you can put in the same position, so now this would lead to pragma noise like:
{{{#!hs instance {-# OVERLAPPING #-} {-# ADOPT #-} C T }}}
In addition, we'd have to update the GHC and Template Haskell ASTs to
support this, and I don't think what this buys us is worth the cost. You’re raising some good points here. My reasoning was that orphan instance warnings are different from most other warnings since you are often in a situation where you ''can’t'' fix it rather than just not wanting to fix it. Also I was hoping that by sidestepping the issues and questions accompanying we might get a significantly simpler implementation and can thereby get this feature a lot quicker. However, as you’ve correctly pointed out it’s not as simple as I’ve thought since it also affects TH so after considering all of this, I think it’s better to just focus the efforts on disabling warnings locally and will try to work on that myself so I’m closing this issue. Thanks for your comments! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13841#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13841: ADOPT pragma for silencing orphan instances warnings per instance -------------------------------------+------------------------------------- Reporter: cocreature | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: wontfix | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #602, #10150 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Lemming): Is there already a ticket for disabling of certain warnings within source regions? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13841#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13841: ADOPT pragma for silencing orphan instances warnings per instance -------------------------------------+------------------------------------- Reporter: cocreature | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.3 Resolution: wontfix | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #602, #10150 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): I think you are looking for #602. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13841#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC