Skip to content

Improve locations in ghci errors

This shows GHC complaining of an error in line 9 of a 7 line file. The error is really on line 4. My guess is it's adding the line within the :{ ... :} to the line of the :}, in which case the best fix is probably to remember the position of the :{ and set the line number to that when evaluating the expression.

Prelude> :! cat script_me
:{
let y1 = 1
    y2 = 2
    Y3 = 3
    y4 = 4
    y5 = 5
:}
Prelude> :! wc -l script_me
7 script_me
Prelude> :script script_me

script_me:9:5: Not in scope: data constructor `Y3'

Additionally, errors in .ghci files currently have <interactive> as their location. Probably sourceConfigFile in ghc/InteractiveUI.hs should set the filename.

Trac metadata
Trac field Value
Version 7.0.1
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