Type error messages containing calls to assert could be prettier.
The following piece of code contains a type error. It also contains a call to
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.