Make it possible to deprecate a method instantiation of a typeclass instance
Consider:
module A where
data Foo = Foo
instance Eq Foo where
-- {-# DEPRECATED (==) "Deprecated for no reason as well" #-}
_a == _b = True
{-# DEPRECATED (==.) "Deprecated for no reason" #-}
(==.) :: Foo -> Foo -> Bool
(==.) _a _b = True
Deprecating (==.) is possible, but it's not possible to deprecate (==) of the Eq Foo instance.
I'd be useful for my use-case of finding out where Ord Unique is used, as these would be a potential sources of non-determinism. Currently the best I can do is to remove the instance, get a compile error, suppress it by fixing up the code and repeat for every affected file.
I imagine it would also be useful if a method turned out to be a bad idea for a particular type and the library author tried to phase it out. It could be that one method is implementable, but has terrible performance.
For my use-case I would be happy with instance level granularity.
Related (but not quite the same):
- https://ghc.haskell.org/trac/ghc/wiki/Design/DeprecationMechanisms#Classmethoddeprecation
- https://ghc.haskell.org/trac/ghc/wiki/Design/DeprecationMechanisms/TypeClassMethods
Trac metadata
| Trac field | Value |
|---|---|
| Version | |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | simonmar |
| Operating system | |
| Architecture |