Implement line-number %-substitution for prompt-string
Currently, GHCi supports the following %
-interpolations:
:set prompt prompt
Sets the string to be used as the prompt in GHCi. Inside prompt, the sequence %s is replaced by the names of the modules currently in scope, and %% is replaced by %. If prompt starts with " then it is parsed as a Haskell String; otherwise it is treated as a literal string.
The attached patch implements the %l
variable, which gets replaced by the current line number of the shown prompt.
The motivation being, that compiler messages refer to interactively entered bindings by the line number when they were defined, which are a bit hard to keep track of, e.g.:
λ> :set prompt "\955:%l> "
λ:3> let x = ()
x :: ()
λ:4> let x = ((),())
x :: ((), ())
λ:5> print xx
<interactive>:5:7:
Not in scope: ‛xx’
Perhaps you meant ‛x’ (line 4)
λ:6> :info x
x :: ((), ()) -- Defined at <interactive>:4:5
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.3 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |