[commit: ghc] type-holes-branch: Do the correct tyding for a module (using a fold). (5a148e0)

Simon Peyton Jones <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : type-holes-branch

http://hackage.haskell.org/trac/ghc/changeset/5a148e01ab50f355a76054017bf94aae23c45fd3

>---------------------------------------------------------------

commit 5a148e01ab50f355a76054017bf94aae23c45fd3
Author: Thijs Alkemade <[email protected]>
Date:   Thu Jan 5 21:24:19 2012 +0100

    Do the correct tyding for a module (using a fold).

>---------------------------------------------------------------

 compiler/typecheck/TcRnDriver.lhs |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs
index 6ec10ac..28ecb62 100644
--- a/compiler/typecheck/TcRnDriver.lhs
+++ b/compiler/typecheck/TcRnDriver.lhs
@@ -225,13 +225,18 @@ tcRnModule hsc_env hsc_src save_rn_syntax
 	tcDump tcg_env ;
 
 	(_, l) <- getEnvs ;
-    holes <- readTcRef $ tcl_holes l ;
-    zonked_holes <- mapM (\(s, ty) -> liftM (\t -> (s, {-tidyType emptyTidyEnv-} t)) $ zonkTcType ty)
-    				$ Map.toList holes ;
-    liftIO $ putStrLn ("tcRnModule: " ++ (showSDoc $ ppr $ zonked_holes)) ;
+	holes <- readTcRef $ tcl_holes l ;
+	zonked_holes <- mapM (\(s, ty) -> liftM (\t -> (s, t)) $ zonkTcType ty)
+				$ Map.toList holes ;
+	let {
+		(env, tys) = foldr tidy (emptyTidyEnv, []) zonked_holes
+            } ;
+	liftIO $ putStrLn ("tcRnModule: " ++ (showSDoc $ ppr $ tys)) ;
+	liftIO $ putStrLn ("tcRnModule2: " ++ (showSDoc $ ppr env)) ;
 
-	return tcg_env
+    	return tcg_env
     }}}}
+    where tidy (s, ty) (env, tys) = let (env', ty') = tidyOpenType env ty in (env', (s, ty') : tys)
 
 
 implicitPreludeWarn :: SDoc
@@ -1447,6 +1452,7 @@ tcRnExpr hsc_env ictxt rdr_expr
     				$ Map.toList $ Map.map (\ty -> mkPiTypes dicts ty) $ holes ;
     let { (env, tys) = foldr tidy (emptyTidyEnv, []) zonked_holes } ;
     liftIO $ putStrLn ("tcRnExpr2: " ++ (showSDoc $ ppr $ tys)) ;
+    liftIO $ putStrLn ("tcRnExpr3: " ++ (showSDoc $ ppr env)) ;
 
     return result
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.