Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
a0b2691b
Commit
a0b2691b
authored
Jan 18, 2008
by
Ian Lynagh
Browse files
Improve the error when :list can't find any code to show
parent
baaed901
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/ghci/InteractiveUI.hs
View file @
a0b2691b
...
...
@@ -2139,9 +2139,23 @@ listCmd :: String -> GHCi ()
listCmd
""
=
do
mb_span
<-
getCurrentBreakSpan
case
mb_span
of
Nothing
->
printForUser
$
text
"not stopped at a breakpoint; nothing to list"
Just
span
|
GHC
.
isGoodSrcSpan
span
->
io
$
listAround
span
True
|
otherwise
->
printForUser
$
text
"unable to list source for"
<+>
ppr
span
Nothing
->
printForUser
$
text
"Not stopped at a breakpoint; nothing to list"
Just
span
|
GHC
.
isGoodSrcSpan
span
->
io
$
listAround
span
True
|
otherwise
->
do
s
<-
getSession
resumes
<-
io
$
GHC
.
getResumeContext
s
case
resumes
of
[]
->
panic
"No resumes"
(
r
:
_
)
->
do
let
traceIt
=
case
GHC
.
resumeHistory
r
of
[]
->
text
"rerunning with :trace,"
_
->
empty
doWhat
=
traceIt
<+>
text
":back then :list"
printForUser
(
text
"Unable to list source for"
<+>
ppr
span
$$
text
"Try"
<+>
doWhat
)
listCmd
str
=
list2
(
words
str
)
list2
::
[
String
]
->
GHCi
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment