summaryrefslogtreecommitdiff
path: root/ghc/Main.hs
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-10-17 12:15:32 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2015-10-19 17:58:24 +0200
commit7bbb61bc969c27a38b26a605d5ac70ac98c328d9 (patch)
tree3cab7ae71b8363ea123d720819a643db3716bf04 /ghc/Main.hs
parent40235c3844a5ab13472dc1bda28c148bc02d0108 (diff)
downloadhaskell-7bbb61bc969c27a38b26a605d5ac70ac98c328d9.tar.gz
Driver: `ghci -e` should behave like `ghc -e` (#9360)
Patch by lukyanov. Reviewed by: bgamari Differential Revision: https://phabricator.haskell.org/D1337
Diffstat (limited to 'ghc/Main.hs')
-rw-r--r--ghc/Main.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs
index 4ef44f20ca..fc6ab88960 100644
--- a/ghc/Main.hs
+++ b/ghc/Main.hs
@@ -492,6 +492,10 @@ isDoMakeMode :: Mode -> Bool
isDoMakeMode (Right (Right DoMake)) = True
isDoMakeMode _ = False
+isDoEvalMode :: Mode -> Bool
+isDoEvalMode (Right (Right (DoEval _))) = True
+isDoEvalMode _ = False
+
#ifdef GHCI
isInteractiveMode :: PostLoadMode -> Bool
isInteractiveMode DoInteractive = True
@@ -629,6 +633,15 @@ setMode newMode newFlag = liftEwM $ do
| isShowGhcUsageMode newMode &&
isDoInteractiveMode oldMode ->
((showGhciUsageMode, newFlag), [])
+
+ -- If we have both -e and --interactive then -e always wins
+ _ | isDoEvalMode oldMode &&
+ isDoInteractiveMode newMode ->
+ ((oldMode, oldFlag), [])
+ | isDoEvalMode newMode &&
+ isDoInteractiveMode oldMode ->
+ ((newMode, newFlag), [])
+
-- Otherwise, --help/--version/--numeric-version always win
| isDominantFlag oldMode -> ((oldMode, oldFlag), [])
| isDominantFlag newMode -> ((newMode, newFlag), [])