[commit: ghc] ghc-8.2: Show only the number of modules in ghci (14ff644)

git at git.haskell.org git at git.haskell.org
Thu Jun 22 14:35:20 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/14ff644c45e04ac6441f2faa3d2a518a7201ab11/ghc

>---------------------------------------------------------------

commit 14ff644c45e04ac6441f2faa3d2a518a7201ab11
Author: Francesco Mazzoli <f at mazzo.li>
Date:   Tue Jun 20 15:00:20 2017 -0400

    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
    
    (cherry picked from commit c85cd9b2ff74c42f02a65edd74949267710f02f4)


>---------------------------------------------------------------

14ff644c45e04ac6441f2faa3d2a518a7201ab11
 ghc/GHCi/UI.hs                              | 27 +++++++++------------------
 testsuite/tests/driver/T8526/T8526.stdout   |  4 ++--
 testsuite/tests/ghci/scripts/T1914.stdout   |  6 +++---
 testsuite/tests/ghci/scripts/T6105.stdout   |  4 ++--
 testsuite/tests/ghci/scripts/ghci058.stdout |  4 ++--
 5 files changed, 18 insertions(+), 27 deletions(-)

diff --git a/ghc/GHCi/UI.hs b/ghc/GHCi/UI.hs
index a509f28..9173d75 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
diff --git a/testsuite/tests/driver/T8526/T8526.stdout b/testsuite/tests/driver/T8526/T8526.stdout
index 3b24506..83b8f95 100644
--- a/testsuite/tests/driver/T8526/T8526.stdout
+++ b/testsuite/tests/driver/T8526/T8526.stdout
@@ -1,6 +1,6 @@
 [1 of 1] Compiling A                ( A.hs, interpreted )
-Ok, modules loaded: A.
+Ok, 1 module loaded.
 True
 [1 of 1] Compiling A                ( A.hs, interpreted )
-Ok, modules loaded: A.
+Ok, 1 module loaded.
 False
diff --git a/testsuite/tests/ghci/scripts/T1914.stdout b/testsuite/tests/ghci/scripts/T1914.stdout
index 063758e..2d1a82b 100644
--- a/testsuite/tests/ghci/scripts/T1914.stdout
+++ b/testsuite/tests/ghci/scripts/T1914.stdout
@@ -1,7 +1,7 @@
 [1 of 2] Compiling T1914B           ( T1914B.hs, interpreted )
 [2 of 2] Compiling T1914A           ( T1914A.hs, interpreted )
-Ok, modules loaded: T1914A, T1914B.
+Ok, 2 modules loaded.
 [2 of 2] Compiling T1914A           ( T1914A.hs, interpreted )
-Failed, modules loaded: T1914B.
+Failed, 1 module loaded.
 [2 of 2] Compiling T1914A           ( T1914A.hs, interpreted )
-Ok, modules loaded: T1914A, T1914B.
+Ok, 2 modules loaded.
diff --git a/testsuite/tests/ghci/scripts/T6105.stdout b/testsuite/tests/ghci/scripts/T6105.stdout
index 73b6d2c..6a846e3 100644
--- a/testsuite/tests/ghci/scripts/T6105.stdout
+++ b/testsuite/tests/ghci/scripts/T6105.stdout
@@ -1,4 +1,4 @@
 [1 of 1] Compiling T6105            ( T6105.hs, interpreted )
-Ok, modules loaded: T6105.
+Ok, 1 module loaded.
 [1 of 1] Compiling T6105            ( T6105.hs, interpreted )
-Ok, modules loaded: T6105.
+Ok, 1 module loaded.
diff --git a/testsuite/tests/ghci/scripts/ghci058.stdout b/testsuite/tests/ghci/scripts/ghci058.stdout
index bc77f05..2028aee 100644
--- a/testsuite/tests/ghci/scripts/ghci058.stdout
+++ b/testsuite/tests/ghci/scripts/ghci058.stdout
@@ -1,4 +1,4 @@
-Ok, modules loaded: Ghci058 (Ghci058.o).
+Ok, 1 module loaded.
 'a'
-Ok, modules loaded: Ghci058 (Ghci058.o).
+Ok, 1 module loaded.
 'b'



More information about the ghc-commits mailing list