@@ -305,14 +305,27 @@ handleDeclaration value = do
305 Just (ExitFailure _, _, err) -> PSCI $ outputStrLn err
305 Just (ExitFailure _, _, err) -> PSCI $ outputStrLn err
306 Nothing -> PSCI $ outputStrLn "Couldn't find node.js"
306 Nothing -> PSCI $ outputStrLn "Couldn't find node.js"
308−handleShowModules :: PSCI ()
308+-- |
309−handleShowModules = do
309+-- Show actual loaded modules in psci.
311+handleShowLoadedModules :: PSCI ()
312+handleShowLoadedModules = do
310 PSCiState { psciLoadedModules = loadedModules } <- PSCI $ lift get
313 PSCiState { psciLoadedModules = loadedModules } <- PSCI $ lift get
311 psciIO $ readModules loadedModules >>= putStrLn
314 psciIO $ readModules loadedModules >>= putStrLn
312 return ()
315 return ()
313 where readModules = return . unlines . nub . map toModuleName
316 where readModules = return . unlines . nub . map toModuleName
314 toModuleName = N.runModuleName . (\ (D.Module mdName _ _) -> mdName) . snd
317 toModuleName = N.runModuleName . (\ (D.Module mdName _ _) -> mdName) . snd
320+-- Show the imported modules in psci.
322+handleShowImportedModules :: PSCI ()
323+handleShowImportedModules = do
324+ PSCiState { psciImportedModuleNames = importedModuleNames } <- PSCI $ lift get
325+ psciIO $ readModules importedModuleNames >>= putStrLn
327+ where readModules = return . unlines . map N.runModuleName
317-- Imports a module, preserving the initial state on failure.
330-- Imports a module, preserving the initial state on failure.
@@ -455,7 +468,8 @@ handleCommand Reset = do
455handleCommand (TypeOf val) = handleTypeOf val
468handleCommand (TypeOf val) = handleTypeOf val
456handleCommand (KindOf typ) = handleKindOf typ
469handleCommand (KindOf typ) = handleKindOf typ
457handleCommand (Browse moduleName) = handleBrowse moduleName
470handleCommand (Browse moduleName) = handleBrowse moduleName
458−handleCommand Show = handleShowModules
471+handleCommand (Show "loaded") = handleShowLoadedModules
472+handleCommand (Show "import") = handleShowImportedModules
459handleCommand _ = PSCI $ outputStrLn "Unknown command"
473handleCommand _ = PSCI $ outputStrLn "Unknown command"
461singleLineFlag :: Cmd.Term Bool
475singleLineFlag :: Cmd.Term Bool