X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=f4e0800427ad152f1922b18cabb2ce362b0a503e;hb=433e74b58ec9d389e39aa62c63599fada0bb75b2;hp=3c663ecfc8fee4873fa9b0ca1dc10510efff4f8a;hpb=b382ce6f044cbea2af7c2489bd8c0f95f7cc724c;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index 3c663ec..f4e0800 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.12 2000/11/22 11:12:52 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.34 2001/02/07 10:45:43 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -13,23 +13,34 @@ module InteractiveUI (interactiveUI) where import CompManager import CmStaticInfo +import ByteCodeLink import DriverFlags -import DriverUtil import DriverState +import DriverUtil +import Type import Linker +import Finder import Module import Outputable -import Panic import Util +import PprType {- instance Outputable Type; do not delete -} +import Panic ( GhcException(..) ) import Exception +#ifndef NO_READLINE import Readline +#endif import IOExts +import Numeric +import List import System +import CPUTime import Directory import IO import Char +import Monad ( when ) + ----------------------------------------------------------------------------- @@ -41,23 +52,29 @@ ghciWelcomeMsg = "\ \|| || || || || (| Bug reports to: glasgow-haskell-bugs@haskell.org \n\ \(|___|| || || (|__|) \\\\______________________________________________________\n" -commands :: [(String, String -> GHCi ())] +commands :: [(String, String -> GHCi Bool)] commands = [ - ("add", addModule), - ("cd", changeDirectory), - ("help", help), - ("?", help), - ("load", loadModule), - ("module", setContext), - ("reload", reloadModule), - ("set", setOptions), - ("type", typeOfExpr), + ("add", keepGoing addModule), + ("cd", keepGoing changeDirectory), + ("help", keepGoing help), + ("?", keepGoing help), + ("load", keepGoing loadModule), + ("module", keepGoing setContext), + ("reload", keepGoing reloadModule), + ("set", keepGoing setOptions), + ("type", keepGoing typeOfExpr), + ("unset", keepGoing unsetOptions), ("quit", quit) ] +keepGoing :: (String -> GHCi ()) -> (String -> GHCi Bool) +keepGoing a str = a str >> return False + shortHelpText = "use :? for help.\n" helpText = "\ +\ Commands available from the prompt:\n\ +\\ \ evaluate \n\ \ :add add a module to the current set\n\ \ :cd change directory to \n\ @@ -66,13 +83,22 @@ helpText = "\ \ :module set the context for expression evaluation to \n\ \ :reload reload the current module set\n\ \ :set