[project @ 2001-07-19 08:28:59 by andy]
[ghc-hetmet.git] / ghc / compiler / compMan / CompManager.lhs
index 30f0b58..107fe7d 100644 (file)
@@ -16,10 +16,12 @@ module CompManager (
     cmGetContext, -- :: CmState -> IO String
 
 #ifdef GHCI
-    cmRunStmt,   --  :: CmState -> DynFlags -> String -> IO (CmState, [Name])
+    cmInfoThing,  -- :: CmState -> DynFlags -> String -> IO (Maybe TyThing)
 
-    cmTypeOfExpr, --  :: CmState -> DynFlags -> String
-                 --  -> IO (CmState, Maybe String)
+    cmRunStmt,   -- :: CmState -> DynFlags -> String -> IO (CmState, [Name])
+
+    cmTypeOfExpr, -- :: CmState -> DynFlags -> String
+                 -- -> IO (CmState, Maybe String)
 
     cmTypeOfName, -- :: CmState -> Name -> IO (Maybe String)
 
@@ -39,7 +41,11 @@ import DriverFlags   ( getDynFlags )
 import DriverPhases
 import DriverUtil
 import Finder
+#ifdef GHCI
+import HscMain         ( initPersistentCompilerState, hscThing )
+#else
 import HscMain         ( initPersistentCompilerState )
+#endif
 import HscTypes
 import RnEnv           ( unQualInScope )
 import Id              ( idType, idName )
@@ -170,6 +176,11 @@ moduleNameToModule mn
 -- cmRunStmt:  Run a statement/expr.
 
 #ifdef GHCI
+cmInfoThing :: CmState -> DynFlags -> String -> IO (Maybe TyThing)
+cmInfoThing CmState{ hst=hst, hit=hit, pcs=pcs, pls=pls, ic=icontext } dflags id
+   = do (pcs, thing) <- hscThing dflags hst hit pcs icontext id
+       return thing
+
 cmRunStmt :: CmState -> DynFlags -> String
        -> IO (CmState,                 -- new state
               [Name])                  -- names bound by this evaluation