
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