diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2015-10-17 12:15:32 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2015-10-19 17:58:24 +0200 |
commit | 7bbb61bc969c27a38b26a605d5ac70ac98c328d9 (patch) | |
tree | 3cab7ae71b8363ea123d720819a643db3716bf04 /ghc/Main.hs | |
parent | 40235c3844a5ab13472dc1bda28c148bc02d0108 (diff) | |
download | haskell-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.hs | 13 |
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), []) |