[commit: ghc] type-holes-branch: I think this is a hack, but it ensures the hole gets the tidied type. (688f213)
Simon Peyton Jones
simonpj at microsoft.com
Mon Sep 17 13:03:57 CEST 2012
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 <thijsalkemade at gmail.com>
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}
%************************************************************************
More information about the Cvs-ghc
mailing list