[commit: ghc] type-holes-branch: I think this is a hack, but it ensures the hole gets the tidied type. (688f213)

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/688f2130b8bc3599ab18ff2e7d2a6c2755f0bea4

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

commit 688f2130b8bc3599ab18ff2e7d2a6c2755f0bea4
Author: Thijs Alkemade <[email protected]>
Date:   Thu May 24 12:16:19 2012 +0200

    I think this is a hack, but it ensures the hole gets the tidied type.
    
    (For example, [a] instead of [a_d].)

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

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

diff --git a/compiler/typecheck/TcErrors.lhs b/compiler/typecheck/TcErrors.lhs
index cbfeef5..a45621f 100644
--- a/compiler/typecheck/TcErrors.lhs
+++ b/compiler/typecheck/TcErrors.lhs
@@ -405,16 +405,15 @@ mkIrredErr ctxt cts
 
 \begin{code}
 mkHoleDeferredError :: Bag Ct -> ReportErrCtxt -> Ct -> TcM ErrMsg
-mkHoleDeferredError allcts ctxt ct@(CHoleCan { cc_hole_nm = nm }) = mkErrorReport ctxt msg
+mkHoleDeferredError allcts ctxt ct@(CHoleCan { cc_hole_nm = nm, cc_flavor = fl }) = mkErrorReport ctxt msg
   where
+    ty = ctFlavPred fl
     orig@(HoleOrigin _ lenv)    = ctLocOrigin (ctWantedLoc ct)
-    ty = ctPred ct
     relevant = mapBag ctPred $ filterBag isRelevant allcts
     isRelevant ct' = case classifyPredType (ctPred ct') of
                       ClassPred {} -> any (`elem` (varSetElems $ tyVarsOfCt ct)) (varSetElems $ tyVarsOfCt ct')
                       _ -> False
-    msg     = addArising orig $ (text "Found hole") <+> ppr nm <+> text "with type" <+> addclasses $$ (text "In scope:" <+> ppr lenv)
-    addclasses = if isEmptyBag relevant then ppr ty else ppr $ mkFunTys (bagToList relevant) ty
+    msg     = addArising orig $ (text "Found hole") <+> ppr nm <+> text "with type" <+> ppr ty $$ (text "In scope:" <+> ppr lenv)
 \end{code}
 
 %************************************************************************
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.