[commit: ghc] type-holes-branch: In the same way as pprTypeForUser, correctly strip foralls. (e9ea7a6)

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/e9ea7a631fc16054612c6e5b628827e27197ed0f

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

commit e9ea7a631fc16054612c6e5b628827e27197ed0f
Author: Thijs Alkemade <[email protected]>
Date:   Thu Jan 5 22:50:24 2012 +0100

    In the same way as pprTypeForUser, correctly strip foralls.

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

 compiler/typecheck/TcRnDriver.lhs |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/compiler/typecheck/TcRnDriver.lhs b/compiler/typecheck/TcRnDriver.lhs
index 7f4b390..2cf0979 100644
--- a/compiler/typecheck/TcRnDriver.lhs
+++ b/compiler/typecheck/TcRnDriver.lhs
@@ -1448,15 +1448,16 @@ tcRnExpr hsc_env ictxt rdr_expr
     
     (_, l) <- getEnvs ;
     holes <- readTcRef $ tcl_holes l ;
-    zonked_holes <- mapM (\(s, ty) -> liftM (\t -> (s, mkForAllTys qtvs t)) $ zonkTcType ty)
-    				$ Map.toList $ Map.map (\ty -> mkPiTypes dicts ty) $ holes ;
+    zonked_holes <- mapM (\(s, ty) -> liftM (\t -> (s, t)) $ zonkTcType ty)
+				$ Map.toList $ Map.map (\ty -> mkForAllTys qtvs $ mkPiTypes dicts ty) $ holes ;
     let { (env, tys) = foldr tidy (emptyTidyEnv, []) zonked_holes } ;
-    liftIO $ putStrLn ("tcRnExpr2: " ++ (showSDoc $ ppr $ tys)) ;
+    liftIO $ putStrLn ("tcRnExpr2: " ++ (showSDoc $ ppr $ map (\(s, t) -> (s, split t)) tys)) ;
     liftIO $ putStrLn ("tcRnExpr3: " ++ (showSDoc $ ppr env)) ;
 
     return $ snd $ tidyOpenType env result
     }
     where tidy (s, ty) (env, tys) = let (env', ty') = tidyOpenType env ty in (env', (s, ty') : tys)
+          split t = let (_, ctxt, ty') = tcSplitSigmaTy $ tidyTopType t in mkPhiTy ctxt ty'
 
 --------------------------
 tcRnImportDecls :: HscEnv
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.