summaryrefslogtreecommitdiff
path: root/ghc
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-11-15 17:19:04 +0000
committerSimon Marlow <marlowsd@gmail.com>2016-11-16 14:31:01 +0000
commit7acee066c210cd469836da32375988e5ee2b32ff (patch)
tree079270809e3f2c9ef1e3548344f6487ebacc6d33 /ghc
parentfa70b1ec2e4638886e610279857c1c7529d6a361 (diff)
downloadhaskell-7acee066c210cd469836da32375988e5ee2b32ff.tar.gz
Avoid calling newDynFlags when there are no changes
This is a small optimisation for :set and :unset
Diffstat (limited to 'ghc')
-rw-r--r--ghc/GHCi/UI.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index 3fe42d23d4..d3c62e6c26 100644
--- a/ghc/GHCi/UI.hs
+++ b/ghc/GHCi/UI.hs
@@ -2564,7 +2564,7 @@ setOptions wds =
let (plus_opts, minus_opts) = partitionWith isPlus wds
mapM_ setOpt plus_opts
-- then, dynamic flags
- newDynFlags False minus_opts
+ when (not (null minus_opts)) $ newDynFlags False minus_opts
packageFlagsChanged :: DynFlags -> DynFlags -> Bool
packageFlagsChanged idflags1 idflags0 =
@@ -2661,7 +2661,7 @@ unsetOptions str
mapM_ unsetOpt plus_opts
no_flags <- mapM no_flag minus_opts
- newDynFlags False no_flags
+ when (not (null no_flags)) $ newDynFlags False no_flags
isMinus :: String -> Bool
isMinus ('-':_) = True