Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,246
    • Issues 4,246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 397
    • Merge Requests 397
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #17868

Closed
Open
Opened Feb 23, 2020 by Niklas Hambüchen@nh2Reporter

Better error messages for misspelled modules

Motivation

Today I lost an hours having written the following code on 8.2.2, adding a field to some conversion function:

  Just something -> Just Api.MyType
    { Api.myField1 = convert (myField1 something)
    , Api.myField2 = convert (myField2 something)
    , API.myField3 = convert (myField3 something)
    }

The error:

    ‘API.myField3’ is not a (visible) field of constructor ‘Api.MyType’
    |
210 |     { API.myField3 = convert (myField3 something)
    |       ^^^^^^^^^^^^

The real issue here is the miss-spelling of API vs Api.

But the GHC error message makes it look like there's a proplem with myField3.

Proposal

  • Point out that there's no module API in scope at all!
  • Underline with ^^^ only the module, not the function name.
  • Perhaps even add a new suggestion ... did you mean 'Api'? to GHC's suggester.
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#17868