[GHC] #3811: Parse errors should display text being parsed

GHC trac at galois.com
Fri Jan 8 04:36:26 EST 2010


#3811: Parse errors should display text being parsed
---------------------------------+------------------------------------------
    Reporter:  asuffield         |       Owner:                   
        Type:  bug               |      Status:  new              
    Priority:  normal            |   Component:  Compiler (Parser)
     Version:  6.12.1            |    Keywords:                   
          Os:  Unknown/Multiple  |    Testcase:                   
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown     
---------------------------------+------------------------------------------
 (More general form of part of #3805)

 Typical parse error:

 {{{
 TestErr.hs:1:0: Invalid type signature
 }}}

 Typical type error:

 {{{
 TestErr.hs:2:6:
     Couldn't match expected type `Int' against inferred type `[Char]'
     In the expression: "x"
     In the definition of `foo': foo = "x"
 }}}

 That explicit description of which expression was being examined is
 frequently useful in quickly understanding an error that occurs in the
 middle of a complex piece of code. There's no obvious reason why we can't
 have the same sort of thing on all parse errors - a quick glance at the
 parser suggests it's already tracking the byte range, so it should be
 fairly straightforward. I'd like to see this (on all parse errors, not
 just this one):

 {{{
 TestErr.hs:1:0:
     Invalid type signature
     While trying to parse: `foreign export ccall foo :: IO ()'
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3811>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list