From a6989971379c26d8c288551d536149675e009e34 Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Thu, 5 Mar 2020 20:44:57 +0100 Subject: Use a Set to represent Ways Should make `member` queries faster and avoid messing up with missing `nubSort`. Metric Increase: hie002 --- ghc/Main.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ghc/Main.hs') diff --git a/ghc/Main.hs b/ghc/Main.hs index 4c546b3afc..1ad2a26e86 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -82,6 +82,7 @@ import Control.Monad.Trans.Class import Control.Monad.Trans.Except (throwE, runExceptT) import Data.Char import Data.List ( isPrefixOf, partition, intercalate ) +import qualified Data.Set as Set import Data.Maybe import Prelude @@ -349,12 +350,12 @@ checkOptions mode dflags srcs objs = do let unknown_opts = [ f | (f@('-':_), _) <- srcs ] when (notNull unknown_opts) (unknownFlagsErr unknown_opts) - when (notNull (filter wayRTSOnly (ways dflags)) + when (not (Set.null (Set.filter wayRTSOnly (ways dflags))) && isInterpretiveMode mode) $ hPutStrLn stderr ("Warning: -debug, -threaded and -ticky are ignored by GHCi") -- -prof and --interactive are not a good combination - when ((filter (not . wayRTSOnly) (ways dflags) /= hostFullWays) + when ((Set.filter (not . wayRTSOnly) (ways dflags) /= hostFullWays) && isInterpretiveMode mode && not (gopt Opt_ExternalInterpreter dflags)) $ do throwGhcException (UsageError -- cgit v1.2.1