diff options
author | Francesco Mazzoli <f@mazzo.li> | 2017-06-20 15:00:20 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-06-21 16:36:08 -0400 |
commit | c85cd9b2ff74c42f02a65edd74949267710f02f4 (patch) | |
tree | a8d039b389d107c2dc54fc95dacaaeed9b5100e0 /ghc | |
parent | 88263f93e0f3add38f925d5afb799eee8df32606 (diff) | |
download | haskell-c85cd9b2ff74c42f02a65edd74949267710f02f4.tar.gz |
Show only the number of modules in ghci
Reviewers: bgamari, austin, simonmar
Reviewed By: bgamari
Subscribers: mpickering, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D3651
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/GHCi/UI.hs | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs index d502fb8800..40bd0e59c3 100644 --- a/ghc/GHCi/UI.hs +++ b/ghc/GHCi/UI.hs @@ -51,7 +51,7 @@ import GHC ( LoadHowMuch(..), Target(..), TargetId(..), InteractiveImport(..), import HsImpExp import HsSyn import HscTypes ( tyThingParent_maybe, handleFlagWarnings, getSafeMode, hsc_IC, - setInteractivePrintName, hsc_dflags, msObjFilePath ) + setInteractivePrintName, hsc_dflags ) import Module import Name import Packages ( trusted, getPackageDetails, getInstalledPackageDetails, @@ -1721,7 +1721,7 @@ afterLoad ok retain_context = do lift revertCAFs -- always revert CAFs on load. lift discardTickArrays loaded_mods <- getLoadedModules - modulesLoadedMsg ok loaded_mods + modulesLoadedMsg ok (length loaded_mods) lift $ setContextAfterLoad retain_context loaded_mods setContextAfterLoad :: Bool -> [GHC.ModSummary] -> GHCi () @@ -1796,27 +1796,18 @@ keepPackageImports = filterM is_pkg_import mod_name = unLoc (ideclName d) -modulesLoadedMsg :: SuccessFlag -> [GHC.ModSummary] -> InputT GHCi () -modulesLoadedMsg ok mods = do +modulesLoadedMsg :: SuccessFlag -> Int -> InputT GHCi () +modulesLoadedMsg ok num_mods = do dflags <- getDynFlags unqual <- GHC.getPrintUnqual - let mod_name mod = do - is_interpreted <- GHC.moduleIsBootOrNotObjectLinkable mod - return $ if is_interpreted - then ppr (GHC.ms_mod mod) - else ppr (GHC.ms_mod mod) - <> text " (" - <> text (normalise $ msObjFilePath mod) - <> text ")" -- fix #9887 - mod_names <- mapM mod_name mods - let mod_commas - | null mods = text "none." - | otherwise = hsep (punctuate comma mod_names) <> text "." - status = case ok of + let status = case ok of Failed -> text "Failed" Succeeded -> text "Ok" - msg = status <> text ", modules loaded:" <+> mod_commas + num_mods_pp = if num_mods == 1 + then "1 module" + else int num_mods <+> "modules" + msg = status <> text "," <+> num_mods_pp <+> "loaded." when (verbosity dflags > 0) $ liftIO $ putStrLn $ showSDocForUser dflags unqual msg |