[GHC] #9173: Better type error messages

GHC ghc-devs at haskell.org
Tue Sep 25 05:35:05 UTC 2018


#9173: Better type error messages
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  goldfire
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:
       Component:  Compiler          |              Version:  7.8.2
      Resolution:                    |             Keywords:
                                     |  TypeErrorMessages
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by nineonine):

 Update:

 I was able to locate all the places where we make `TypeEqOrigin`. We do
 this with a help of a smart constructor `mkCheckExpType`. There are around
 80-90 places (across 12 modules) where we use it. There is another
 function `synKnownType` that uses `mkCheckExpType` which has another 25
 occurrences.

 For now I just used dummy text everywhere to be able to compile it.

 Here you can see more detailed search results for these functions:
 * `mkCheckExpType` - https://lpaste.net/7745839270543228928
 * `synKnownType` - https://lpaste.net/4510196100136697856

 I have already changed some of the messages where I was able to infer the
 context and come up with meaningful explanations. Here is a screenshot of
 examples from the ticket with new messages - https://prnt.sc/kycm4c,
 however, some places are tricky so I will probably need more time to spend
 on them.

 Right now my plan is the following - I want to come up with all the test
 cases(programs) that would call all the code parts where we use the above
 mentioned functions.  By doing that, I will slowly weed out all the dummy
 messages and replace with meaningful ones.

 As suggested, I am collecting all the notes of my changes.

 Perhaps, it is a good time to submit a patch to Phabricator? We could
 proceed with a discussion there and it would be much easier to discuss all
 the new messages (with line comments). By the way, If someone could code
 review and help with new messages - that would be greatly appreciated!
 Thank you.

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


More information about the ghc-tickets mailing list