From cdfe9b087902b321b56dd58df7d996a966947585 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Thu, 26 Apr 2007 16:35:40 +0000 Subject: [PATCH] Dont tidy up tyvars after :print type reconstruction I introduced a bug yesterday when I changed the way tidying up was performed. As a result of tidying, cvObtainTerm could be returning types with regular tyvars inside, which never should. But actually, it's better if we do not do the tidying up, in order to keep the tyvar names from the environment. New names will be introduced only when an existential is found, which is not so common. In this case the user will see a funny name. Is that really an issue? --- compiler/ghci/RtClosureInspect.hs | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/compiler/ghci/RtClosureInspect.hs b/compiler/ghci/RtClosureInspect.hs index 9db0a18..7c144c0 100644 --- a/compiler/ghci/RtClosureInspect.hs +++ b/compiler/ghci/RtClosureInspect.hs @@ -472,31 +472,7 @@ instScheme ty | (tvs, rho) <- tcSplitForAllTys ty = liftTcM$ do return (ty', zipTopTvSubst tvs' (mkTyVarTys tvs)) cvObtainTerm :: HscEnv -> Bool -> Maybe Type -> HValue -> IO Term -cvObtainTerm hsc_env force mb_ty a = do - -- Obtain the term and tidy the type before returning it - term <- cvObtainTerm1 hsc_env force mb_ty a - let term' = tidyTypes term - return term' - where allvars = nub . foldTerm TermFold { - fTerm = \ty _ _ tt -> - varEnvElts(tyVarsOfType ty) ++ concat tt, - fSuspension = \_ mb_ty _ _ -> - maybe [] (varEnvElts . tyVarsOfType) mb_ty, - fPrim = \ _ _ -> [] } - tidyTypes term = let - go = foldTerm idTermFold { - fTerm = \ty dc hval tt -> - Term (tidy ty) dc hval tt, - fSuspension = \ct mb_ty hval n -> - Suspension ct (fmap tidy mb_ty) hval n } - tidy ty = tidyType (emptyTidyOccEnv, tidyVarEnv) ty - tidyVarEnv = mkVarEnv$ - [ (v, alpha_tv `setTyVarUnique` varUnique v) - | (alpha_tv,v) <- zip alphaTyVars (allvars term)] - in go term - -cvObtainTerm1 :: HscEnv -> Bool -> Maybe Type -> HValue -> IO Term -cvObtainTerm1 hsc_env force mb_ty hval = runTR hsc_env $ do +cvObtainTerm hsc_env force mb_ty hval = runTR hsc_env $ do tv <- liftM mkTyVarTy (newVar argTypeKind) case mb_ty of Nothing -> go tv tv hval -- 1.7.10.4