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

GHC ghc-devs at haskell.org
Thu May 5 10:54:15 UTC 2016


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

 Good idea in principle -- but fragile.  E.g.
 {{{
 f :: Eq a => a -> a -> Bool
 f x y = not (x == y)

 blah = f Foo Foo
 }}}
 At the call of `f` GHC can't see that you are ultimately going to use the
 `(==)` method of the `Eq` dictionary passed to `f`.  So would you expect
 to get a deprecation message here?

 If you think about what it translates to, it's a bit like
 {{{
 blah = f (eqFoo, neqFoo) Foo Foo
 }}}
 where the tuple argument is the dictionary. If you wrote it like that
 you'd get deprecations for both `eqFoo` and `newFoo` even though only one
 of them is ultimately actually called.

 I don't think I see a useful, robust path here, yet.

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


More information about the ghc-tickets mailing list