[GHC] #9774: Type error messages containing calls to assert could be prettier.
#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
#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 Resolution: | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"0f930ba2039e28d0083780a58adb37ff01a92019/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="0f930ba2039e28d0083780a58adb37ff01a92019" Move expansion of 'assert' from renamer to typechecker This improves error messages when there is a type error, fixing Trac #9774 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9774#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9774: Type error messages containing calls to assert could be prettier. -------------------------------------+------------------------------------- Reporter: josef | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: fixed | Keywords: Operating System: | Architecture: Unknown/Multiple Unknown/Multiple | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | typecheck/should_fail/T9774 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => typecheck/should_fail/T9774 * resolution: => fixed Comment: Good idea, thanks -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9774#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC