From 8c440cff43c20c3b79cd80e7f65fadd95328ff43 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Fri, 20 Apr 2007 10:35:16 +0000 Subject: [PATCH] new commnad :abandon, discards the current computation (used to be :break stop) --- compiler/ghci/InteractiveUI.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/ghci/InteractiveUI.hs b/compiler/ghci/InteractiveUI.hs index 8066aa4..821eee9 100644 --- a/compiler/ghci/InteractiveUI.hs +++ b/compiler/ghci/InteractiveUI.hs @@ -102,6 +102,7 @@ builtin_commands = [ -- Hugs users are accustomed to :e, so make sure it doesn't overlap ("?", keepGoing help, False, completeNone), ("add", keepGoingPaths addModule, False, completeFilename), + ("abandon", keepGoing abandonCmd, False, completeNone), ("break", keepGoing breakCmd, False, completeIdentifier), ("browse", keepGoing browseCmd, False, completeModule), ("cd", keepGoing changeDirectory, False, completeFilename), @@ -146,6 +147,7 @@ helpText = "\n" ++ " evaluate/run \n" ++ " :add ... add module(s) to the current target set\n" ++ + " :abandon at a breakpoint, abandon current computation\n" ++ " :break [] [] set a breakpoint at the specified location\n" ++ " :break set a breakpoint on the specified function\n" ++ " :browse [*] display the names defined by \n" ++ @@ -1383,6 +1385,16 @@ doContinue actionBeforeCont = do finishEvalExpr names return False +abandonCmd :: String -> GHCi () +abandonCmd "" = do + mb_res <- popResume + case mb_res of + Nothing -> do + io $ putStrLn "There is no computation running." + Just (span,_,_) -> + return () + -- the prompt will change to indicate the new context + deleteCmd :: String -> GHCi () deleteCmd argLine = do deleteSwitch $ words argLine -- 1.7.10.4