[GHC] #12014: Make it possible to deprecate a method instantiation of a typeclass instance

GHC ghc-devs at haskell.org
Wed May 4 13:46:29 UTC 2016


#12014: Make it possible to deprecate a method instantiation of a typeclass
instance
-------------------------------------+-------------------------------------
           Reporter:  niteria        |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:
           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:
-------------------------------------+-------------------------------------
 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

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12014>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list