From: Pepe Iborra Date: Mon, 11 Dec 2006 15:34:53 +0000 (+0000) Subject: Fix an issue with lazyness in the closure viewer X-Git-Tag: 2006-12-17~5 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=8d5364c135b7d40ae62c63ff9e65c684a1712694 Fix an issue with lazyness in the closure viewer --- diff --git a/compiler/ghci/Linker.lhs b/compiler/ghci/Linker.lhs index 640fc9d..e105bb2 100644 --- a/compiler/ghci/Linker.lhs +++ b/compiler/ghci/Linker.lhs @@ -202,7 +202,9 @@ recoverDCInRTS a = do getHValue :: Name -> IO (Maybe HValue) getHValue name = do pls <- readIORef v_PersistentLinkerState - return$ fmap snd (lookupNameEnv (closure_env pls) name) + case lookupNameEnv (closure_env pls) name of + Just (_,x) -> return$ Just x + _ -> return Nothing withExtendedLinkEnv :: [(Name,HValue)] -> IO a -> IO a withExtendedLinkEnv new_env action diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs index cbe82c4..ef9fd02 100644 --- a/compiler/main/GHC.hs +++ b/compiler/main/GHC.hs @@ -2286,7 +2286,10 @@ mkSite (pkgName, modName, sitenum) = (mkModule (stringToPackageId pkgName) (mkModuleName modName), sitenum) obtainTerm :: Session -> Bool -> Id -> IO (Maybe Term) -obtainTerm sess force id = withSession sess $ \hsc_env -> - getHValue (varName id) >>= traverse (cvObtainTerm hsc_env force Nothing) +obtainTerm sess force id = withSession sess $ \hsc_env -> do + mb_v <- getHValue (varName id) + case mb_v of + Just v -> fmap Just$ cvObtainTerm hsc_env force (Just$ idType id) v + Nothing -> return Nothing #endif /* GHCI */