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,384
    • Issues 4,384
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 372
    • Merge Requests 372
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #5057

Closed
Open
Opened Mar 28, 2011 by duncan@trac-duncan

poor parser error message

Here's the error message:

Blah.hs:52:0:
    parse error (possibly incorrect indentation)

Here's the last few lines of the file:

    condition (foo "thing" <= bar (fromIntegral (a + b))
            && foo "other" > bar (fromIntegral(a - b))
	       (baz 1) (baz 0)

-- this is line 52, the apparent location of the error

Can you guess what the error is? Yes, of course we can, because we've seen this bad error message enough times to know that it really means

Blah.hs:47:15:
    unterminated '('

This error confuses new and casual users. It directs them away from the location of the error and provides a hint "possibly incorrect indentation" that will also send them in the wrong direction.

Probably this message, and the parse error messages generally are not good because of limitations of happy. happy does not provide much to help construct error messages except the state of the parser at the time. The frown parser generator provides slightly more info, it provides the parse error function with the set of tokens that were expected at that point. If happy were extended in that way, that might be just enough to produce a better error since we could see that ')' was in the set of expected tokens.

Trac metadata
Trac field Value
Version 6.12.3
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Parser)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#5057