[GHC] #15814: Orphan Instance Overlap Error Message

GHC ghc-devs at haskell.org
Sat Oct 27 12:57:09 UTC 2018


#15814: Orphan Instance Overlap Error Message
-------------------------------------+-------------------------------------
        Reporter:  parsonsmatt       |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:  newcomer
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * keywords:   => newcomer


Comment:

 Good idea. I don't think this would be that hard to do, given that we do
 something similar for other errors already. Here is an example of an
 ambiguous name occurrence error message (taken from the `tcfail037` test
 case):

 {{{
 tcfail037.hs:7:11: error:
     Ambiguous occurrence ‘+’
     It could refer to either ‘Prelude.+’,
                              imported from ‘Prelude’ at
 tcfail037.hs:3:8-17
                              (and originally defined in ‘GHC.Num’)
                           or ‘ShouldFail.+’, defined at tcfail037.hs:10:5
 }}}

 That "and originally defined in ..." part is exactly what we need. The
 code for this error message can be found
 [http://git.haskell.org/ghc.git/blob/23956b2ada690c78a134fe6d149940c777c7efcc:/compiler/basicTypes/RdrName.hs#l1251
 here], in `ppr_defn_site`. We'd just need to incorporate similar logic to
 the function
 [http://git.haskell.org/ghc.git/blob/23956b2ada690c78a134fe6d149940c777c7efcc:/compiler/typecheck/TcErrors.hs#l2534
 here] which constructs error messages for overlapping instances.

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


More information about the ghc-tickets mailing list