
#11796: Warn about unwanted instances in a modular way -------------------------------------+------------------------------------- Reporter: Lemming | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #11219 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Lemming): Replying to [comment:3 RyanGlScott]:
* We currently have `WARNING` and `DEPRECATED` pragmas ([http://downloads.haskell.org/~ghc/8.0.1/docs/html/users_guide/glasgow_exts.h... #warning-and-deprecated-pragmas link]) that serve a very similar role to what you're proposing.
A unification with the WARNING pragma looks like a good idea to me. I think I did not consider it, because currently warnings cannot be grouped. But if WARNINGs can be grouped we could re-use this capability for `instance` warnings.
This always emits a warning. But we could envision a flags like `-Wpragma-error="unsafePerformIO"` or `-Wpragma- suppress="unsafePerformIO"` that would either elevate a `WARNING` pragma to an error or suppress its warning altogether, respectively. (We'd also need `-Wpragma-warn` for when we want to explicitly request a warning, rather than an error). So implementing `-Wpragma-error`, `-Wpragma-warn`, and `-Wpragma-suppress` seems like an important step.
The machinery sketched in #11219 seems like a good way to switch between the effect of hitting a warning.
* Lastly, we'd need some form of conflict resolution for unique strings. I could certainly see a scenario where a package has multiple `FooInt` strings floating around. Perhaps we could use a representation of `-Wpragma-warn=<package>:<module>:
`, where `<package>` and `<module>` are optional.
For `instance`s the module name should not be part of the identifier. The definition of the instance can be anywhere in the package in a private module. This module can be renamed without even a minor version bump. But when I think about it, the same is true for function identifiers. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11796#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler