{-# OPTIONS -#include "Linker.h" #-}
-----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.153 2003/05/19 15:39:17 simonpj Exp $
+-- $Id: InteractiveUI.hs,v 1.157 2003/07/21 14:33:19 simonmar Exp $
--
-- GHC Interactive User Interface
--
import MkIface ( ifaceTyThing )
import DriverFlags
import DriverState
-import DriverUtil ( remove_spaces, handle )
+import DriverUtil ( remove_spaces )
import Linker ( showLinkerState, linkPackages )
import Util
import IdInfo ( GlobalIdDetails(..) )
import Config
#ifndef mingw32_HOST_OS
+import DriverUtil( handle )
import System.Posix
#if __GLASGOW_HASKELL__ > 504
hiding (getEnv)
interactiveUI :: [FilePath] -> IO ()
interactiveUI srcs = do
dflags <- getDynFlags
- saveDynFlags -- Save the dynamic flags, so that
- -- the later restore will find them
+
cmstate <- cmInit Interactive;
hFlush stdout
changeDirectory :: String -> GHCi ()
changeDirectory dir = do
+ state <- getGHCiState
+ when (targets state /= []) $
+ io $ putStr "Warning: changing directory causes all loaded modules to be unloaded, \n\
+ \because the search path has changed.\n"
+ dflags <- io getDynFlags
+ cmstate1 <- io (cmUnload (cmstate state) dflags)
+ setGHCiState state{ cmstate = cmstate1, targets = [] }
+ setContextAfterLoad []
dir <- expandPath dir
io (setCurrentDirectory dir)