+hscThing -- like hscStmt, but deals with a single identifier
+ :: DynFlags
+ -> HomeSymbolTable
+ -> HomeIfaceTable
+ -> PersistentCompilerState -- IN: persistent compiler state
+ -> InteractiveContext -- Context for compiling
+ -> String -- The identifier
+ -> IO ( PersistentCompilerState,
+ Maybe TyThing )
+hscThing dflags hst hit pcs0 icontext id
+ = let
+ InteractiveContext {
+ ic_rn_env = rn_env,
+ ic_type_env = type_env,
+ ic_module = scope_mod } = icontext
+ fname = mkFastString id
+ rn = mkUnqual dataName fname -- need to guess correct namespace
+ stmt = ResultStmt (HsVar rn) noSrcLoc
+ in
+ do { (pcs, err, maybe_stmt) <- renameStmt dflags hit hst pcs0 scope_mod scope_mod rn_env stmt
+ ; case maybe_stmt of
+ Nothing -> return (pcs, Nothing)
+ Just (n:ns, _) -> return (pcs, lookupType hst type_env n)
+ }
+