FIX #1378 Add option for a shorter banner on GHCi startup
[ghc-hetmet.git] / compiler / ghci / InteractiveUI.hs
index 0f80fa2..2497bad 100644 (file)
@@ -8,7 +8,8 @@
 -----------------------------------------------------------------------------
 module InteractiveUI ( 
        interactiveUI,
-       ghciWelcomeMsg
+       ghciWelcomeMsg,
+       ghciShortWelcomeMsg
    ) where
 
 #include "HsVersions.h"
@@ -41,10 +42,7 @@ import Util
 import FastString
 
 #ifndef mingw32_HOST_OS
-import System.Posix
-#if __GLASGOW_HASKELL__ > 504
-       hiding (getEnv)
-#endif
+import System.Posix hiding (getEnv)
 #else
 import GHC.ConsoleHandler ( flushConsole )
 import System.Win32      ( setConsoleCP, setConsoleOutputCP )
@@ -93,6 +91,10 @@ ghciWelcomeMsg =
  "/ /_\\\\/ __  / /___| |    http://www.haskell.org/ghc/\n"++
  "\\____/\\/ /_/\\____/|_|    Type :? for help.\n"
 
+ghciShortWelcomeMsg =
+    "GHCi, version " ++ cProjectVersion ++
+    ": http://www.haskell.org/ghc/  :? for help"
+
 type Command = (String, String -> GHCi Bool, Bool, String -> IO [String])
 cmdName (n,_,_,_) = n
 
@@ -155,7 +157,7 @@ helpText =
  "   :add <filename> ...         add module(s) to the current target set\n" ++
  "   :browse [*]<module>         display the names defined by <module>\n" ++
  "   :cd <dir>                   change directory to <dir>\n" ++
- "   :cmd <expr>                 run the commands returned by <expr>::IO String"++
+ "   :cmd <expr>                 run the commands returned by <expr>::IO String\n" ++
  "   :ctags [<file>]             create tags file for Vi (default: \"tags\")\n" ++
  "   :def <cmd> <expr>           define a command :<cmd>\n" ++
  "   :edit <file>                edit file\n" ++
@@ -1471,6 +1473,10 @@ wantNameFromInterpretedModule noCanDo str and_then = do
       []    -> return ()
       (n:_) -> do
             let modl = GHC.nameModule n
+            if not (GHC.isExternalName n)
+               then noCanDo n $ ppr n <>
+                                text " is not defined in an interpreted module"
+               else do
             is_interpreted <- io (GHC.moduleIsInterpreted session modl)
             if not is_interpreted
                then noCanDo n $ text "module " <> ppr modl <>