[GHC] #9173: Better type error messages

GHC ghc-devs at haskell.org
Thu Sep 24 15:40:13 UTC 2015


#9173: Better type error messages
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.2
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by thomie):

 Reddit user physicologist
 [https://www.reddit.com/r/haskell/comments/3m2iiv/ghc_error_messages/cvckb3c
 writes]:

 While I love the the proposal in the ticket, I feel that a purely textual
 change to the error message could be a great boon without changing a
 single line of code.

 "Expected" versus "actual" don't really the nature of the problem. For
 example, what is the type of foo in the following
 {{{
 foo :: Int
 foo = "Howdy!"
 }}}
 Is foo actually an Int, since that was declared? Did the compiler expect
 foo to be a String, since that's what we passed it? Or is foo actually a
 "String", since that's what it contained, but the compiler expected a Int,
 since that's what we told it would be contained?

 Perhaps just changing
 {{{
 Couldn't match expected type 'Foo' with actual type 'Bar'
 }}}
 to
 {{{
 Couldn't match declared type 'Foo' against a value of type `Bar'
 }}}
 might make things clearer?

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


More information about the ghc-tickets mailing list