Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,248
    • Issues 5,248
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 564
    • Merge requests 564
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #9774
Closed
Open
Issue created Nov 05, 2014 by josef@trac-josef

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 assert.

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.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking