[GHC] #9774: Type error messages containing calls to assert could be prettier.

GHC ghc-devs at haskell.org
Wed Nov 5 18:11:07 UTC 2014


#9774: Type error messages containing calls to assert could be prettier.
-------------------------------------+-------------------------------------
       Reporter:  josef              |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:
     Blocked By:                     |  None/Unknown
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 The following piece of code contains a type error. It also contains a call
 to `assert`.

 {{{#!hs
 import Control.Exception.Assert

 main = putStrLn (assert True 'a')
 }}}

 GHC 7.8.3 reports the type error as follows:
 {{{
 Err.hs:3:30:
     Couldn't match type ‘Char’ with ‘[Char]’
     Expected type: String
       Actual type: Char
     In the third argument of ‘GHC.IO.Exception.assertError’, namely
       ‘'a'’
     In the first argument of ‘putStrLn’, namely
       ‘(GHC.IO.Exception.assertError "Err.hs:3:18-23"## True 'a')’
     In the expression:
       putStrLn (GHC.IO.Exception.assertError "Err.hs:3:18-23"## True 'a')
 }}}

 The calls to `assert` has already been desugared, which is not necessarily
 very readable. I think it would be better if GHC just printed the call to
 `assert` as it appeared in the source.

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


More information about the ghc-tickets mailing list