X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fghci%2FGhciMonad.hs;h=8374491891ceafc71ca7a5ab4d6ce6af6a20ee14;hb=ee26207114635c480dbc7518c0510545a6f62611;hp=0bd484ad792d293bc6e2f42edb740450f0452827;hpb=03aa64d6915234c424715172432cb0e7dd5297ba;p=ghc-hetmet.git diff --git a/compiler/ghci/GhciMonad.hs b/compiler/ghci/GhciMonad.hs index 0bd484a..8374491 100644 --- a/compiler/ghci/GhciMonad.hs +++ b/compiler/ghci/GhciMonad.hs @@ -36,7 +36,6 @@ import Data.Int ( Int64 ) import Data.IORef import Data.List import System.CPUTime -import System.Directory import System.Environment import System.IO import Control.Monad as Monad @@ -73,7 +72,6 @@ data GHCiState = GHCiState -- were supposed to be in the context but currently had errors, -- but this was complicated. Just replaying the :module commands -- seems to be the right thing. - virtual_path :: FilePath, ghc_e :: Bool -- True if this is 'ghc -e' (or runghc) } @@ -170,12 +168,8 @@ instance GhcMonad GHCi where instance ExceptionMonad GHCi where gcatch m h = GHCi $ \r -> unGHCi m r `gcatch` (\e -> unGHCi (h e) r) - gbracket acq rel ib = - GHCi $ \r -> gbracket (unGHCi acq r) - (\x -> unGHCi (rel x) r) - (\x -> unGHCi (ib x) r) - gfinally th cu = - GHCi $ \r -> gfinally (unGHCi th r) (unGHCi cu r) + gblock (GHCi m) = GHCi $ \r -> gblock (m r) + gunblock (GHCi m) = GHCi $ \r -> gunblock (m r) instance WarnLogMonad GHCi where setWarnings warns = liftGhc $ setWarnings warns @@ -243,19 +237,8 @@ printForUserPartWay doc = do unqual <- GHC.getPrintUnqual io $ Outputable.printForUserPartWay stdout opt_PprUserLength unqual doc -withVirtualPath :: GHCi a -> GHCi a -withVirtualPath m = do - ghci_wd <- io getCurrentDirectory -- Store the cwd of GHCi - st <- getGHCiState - io$ setCurrentDirectory (virtual_path st) - result <- m -- Evaluate in the virtual wd.. - vwd <- io getCurrentDirectory - setGHCiState (st{ virtual_path = vwd}) -- Update the virtual path - io$ setCurrentDirectory ghci_wd -- ..and restore GHCi wd - return result - runStmt :: String -> GHC.SingleStep -> GHCi GHC.RunResult -runStmt expr step = withVirtualPath$ do +runStmt expr step = do st <- getGHCiState reifyGHCi $ \x -> withProgName (progname st) $ @@ -266,9 +249,7 @@ runStmt expr step = withVirtualPath$ do GHC.runStmt expr step resume :: GHC.SingleStep -> GHCi GHC.RunResult -resume step = withVirtualPath$ do - GHC.resume step - +resume step = GHC.resume step -- -------------------------------------------------------------------------- -- timing & statistics