X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=cf301f47fb68c7f00f05dbd8c055844a655e6057;hb=0ef29fb878dd6517d2716afb056bcf2536c2562e;hp=e1f5e201e680845d923a630546323219c25a978b;hpb=bce8412827ad74756a44a1bcdc29b665ba39603f;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index e1f5e20..cf301f4 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.6 2000/11/20 16:51:35 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.28 2001/01/18 12:54:16 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -14,22 +14,29 @@ module InteractiveUI (interactiveUI) where import CompManager import CmStaticInfo import DriverFlags -import DriverUtil import DriverState import Linker 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,35 +48,52 @@ ghciWelcomeMsg = "\ \|| || || || || (| Bug reports to: glasgow-haskell-bugs@haskell.org \n\ \(|___|| || || (|__|) \\\\______________________________________________________\n" -commands :: [(String, String -> GHCi ())] +commands :: [(String, String -> GHCi Bool)] commands = [ - ("cd", changeDirectory), - ("help", help), - ("?", help), - ("load", loadModule), - ("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\ -\ :help display this list of commands\n\ -\ :? display this list of commands\n\ +\ :help, :? display this list of commands\n\ \ :load load a module (and it dependents)\n\ -\ :reload reload the current program\n\ -\ :set ... set options\n\ +\ :module set the context for expression evaluation to \n\ +\ :reload reload the current module set\n\ +\ :set