From f2643821042fd3d859e7c6eaad459e6a2cb756a2 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Wed, 11 Jul 2007 09:54:21 +0000 Subject: [PATCH] Ask for a HscEnv instead of a Session in InteractiveEval.obtainTerm This does a better job of showing that obtainTerm does not alter the Session --- compiler/ghci/Debugger.hs | 10 +++++----- compiler/main/InteractiveEval.hs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/ghci/Debugger.hs b/compiler/ghci/Debugger.hs index f662217..b7c8e32 100644 --- a/compiler/ghci/Debugger.hs +++ b/compiler/ghci/Debugger.hs @@ -63,12 +63,12 @@ pprintClosureCommand session bindThings force str = do -- Do the obtainTerm--bindSuspensions-computeSubstitution dance go :: Session -> Id -> IO (Maybe TvSubst) go cms id = do - term_ <- obtainTerm cms force id - term <- tidyTermTyVars cms term_ - term' <- if not bindThings then return term + term_ <- withSession cms $ \hsc_env -> obtainTerm hsc_env force id + term <- tidyTermTyVars cms term_ + term' <- if not bindThings then return term else bindSuspensions cms term - showterm <- printTerm cms term' - unqual <- GHC.getPrintUnqual cms + showterm <- printTerm cms term' + unqual <- GHC.getPrintUnqual cms let showSDocForUserOneLine unqual doc = showDocWith LeftMode (doc (mkErrStyle unqual)) (putStrLn . showSDocForUserOneLine unqual) diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs index 1f36861..f1e6079 100644 --- a/compiler/main/InteractiveEval.hs +++ b/compiler/main/InteractiveEval.hs @@ -819,11 +819,11 @@ isModuleInterpreted s mod_summary = withSession s $ \hsc_env -> where obj_linkable = isObjectLinkable (expectJust "showModule" (hm_linkable mod_info)) -obtainTerm1 :: Session -> Bool -> Maybe Type -> a -> IO Term -obtainTerm1 sess force mb_ty x = withSession sess $ \hsc_env -> cvObtainTerm hsc_env force mb_ty (unsafeCoerce# x) +obtainTerm1 :: HscEnv -> Bool -> Maybe Type -> a -> IO Term +obtainTerm1 hsc_env force mb_ty x = cvObtainTerm hsc_env force mb_ty (unsafeCoerce# x) -obtainTerm :: Session -> Bool -> Id -> IO Term -obtainTerm sess force id = withSession sess $ \hsc_env -> do +obtainTerm :: HscEnv -> Bool -> Id -> IO Term +obtainTerm hsc_env force id = do hv <- Linker.getHValue hsc_env (varName id) cvObtainTerm hsc_env force (Just$ idType id) hv -- 1.7.10.4