Don't add targets that can't be found in GHCi
authorJulian Priestley <jupriest@devvm610.lla2.facebook.com>
Thu, 1 Feb 2018 02:35:00 +0000 (21:35 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 1 Feb 2018 04:51:20 +0000 (23:51 -0500)
commit8f668bdaa1909c28a041db1680585bbf7d833987
tree0a0fa3c85fe660235fa2e468e70229ed73468a30
parentfe485f2961324d3b798d4dc8b1ccd27e887fa213
Don't add targets that can't be found in GHCi

When using the :add command in haxlsh/ghci, a module/file that can't
be found is still added to the list of targets, resulting in an error
message for the bad module/file for every subsequent usage of the
command. The add command should verify that the module/file can be
found before adding it to the list of targets.

Also add a ":show targets" command to show the currently added list of
commands, and an ":unadd" command to remove a target.

Test Plan:
Add a new GHCi testcase that checks that :add doesn't remember either
files or modules that could not be found, and that both the new :show
and :unadd commands work as expected.

Reviewers: simonmar, bgamari

Reviewed By: simonmar

Subscribers: rwbarton, thomie, carter

GHC Trac Issues: #14676

Differential Revision: https://phabricator.haskell.org/D4321

(cherry picked from commit 0bff9e677f0569bc8a7207c20cddddfd67e2448f)
ghc/GHCi/UI.hs
testsuite/tests/ghci/scripts/T14676.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T14676.stdout [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T