[GHC] #999: Misattributed parse error in do block
GHC
trac at galois.com
Sun Nov 12 23:05:16 EST 2006
#999: Misattributed parse error in do block
-----------------------------------+----------------------------------------
Reporter: red5_2 at hotmail.com | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Parser) | Version: 6.4.2
Severity: normal | Keywords:
Difficulty: Unknown | Testcase:
Architecture: Unknown | Os: Unknown
-----------------------------------+----------------------------------------
In the following program, there is clearly an extra closing parenthesis.
However, the error message doesn't point to the actual problem:
{{{
main = do x <- 1)
return ()
-- test.hs:1:10: The last statement in a 'do' construct must be an
expression
}}}
The reported error is at the beginning of the statement "`x <- 1`", not at
the closing parenthesis. When this first happened to me, I spent a lot of
time puzzling over the beginning of the statement and the indentation of
various lines before I discovered the real problem.
In this example, the error could be attributed to that unmatched
parenthesis. Since 'do' blocks can legitimately be enclosed in
parentheses, it might be more usable if the error message could identify
the locations of both the statement and the end of the 'do' block -- this
would point out both potential problem locations.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/999>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list