[commit: ghc] wip/impredicativity: Add printing of error messages involving InstanceOf constraints (3dc731c)
git at git.haskell.org
git at git.haskell.org
Wed Jun 24 11:38:07 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/impredicativity
Link : http://ghc.haskell.org/trac/ghc/changeset/3dc731c6c34156994e1d2cbfff791ec6052cfd94/ghc
>---------------------------------------------------------------
commit 3dc731c6c34156994e1d2cbfff791ec6052cfd94
Author: Alejandro Serrano <trupill at gmail.com>
Date: Wed Jun 24 13:38:32 2015 +0200
Add printing of error messages involving InstanceOf constraints
>---------------------------------------------------------------
3dc731c6c34156994e1d2cbfff791ec6052cfd94
compiler/typecheck/TcErrors.hs | 19 +++++++++++++++++--
compiler/typecheck/TcSimplify.hs | 1 +
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index 36b7947..655bc60 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -348,13 +348,14 @@ reportWanteds ctxt (WC { wc_simple = simples, wc_insol = insols, wc_impl = impli
, ("Implicit params", is_ip, False, mkGroupReporter mkIPErr)
, ("Irreds", is_irred, False, mkGroupReporter mkIrredErr)
- , ("Dicts", is_dict, False, mkGroupReporter mkDictErr) ]
+ , ("Dicts", is_dict, False, mkGroupReporter mkDictErr)
+ , ("Instantiation", is_instanceof, False, mkGroupReporter mkInstanceOfErr) ]
(&&&) :: (Ct->PredTree->Bool) -> (Ct->PredTree->Bool) -> (Ct->PredTree->Bool)
(&&&) p1 p2 ct pred = p1 ct pred && p2 ct pred
is_skol_eq, is_hole, is_dict,
- is_equality, is_ip, is_irred :: Ct -> PredTree -> Bool
+ is_equality, is_ip, is_irred, is_instanceof :: Ct -> PredTree -> Bool
utterly_wrong _ (EqPred NomEq ty1 ty2) = isRigid ty1 && isRigid ty2
utterly_wrong _ _ = False
@@ -378,6 +379,9 @@ reportWanteds ctxt (WC { wc_simple = simples, wc_insol = insols, wc_impl = impli
is_irred _ (IrredPred {}) = True
is_irred _ _ = False
+ is_instanceof _ (InstanceOfPred {}) = True
+ is_instanceof _ _ = False
+
-- isRigidEqPred :: PredTree -> Bool
-- isRigidEqPred (EqPred NomEq ty1 ty2) = isRigid ty1 && isRigid ty2
@@ -1725,3 +1729,14 @@ solverDepthErrorTcS loc ty
, text "(any upper bound you could choose might fail unpredictably with"
, text " minor updates to GHC, so disabling the check is recommended if"
, text " you're sure that type checking should terminate)" ]
+
+{-
+************************************************************************
+* *
+ Instantiation errors
+* *
+************************************************************************
+-}
+
+mkInstanceOfErr :: ReportErrCtxt -> [Ct] -> TcM ErrMsg
+mkInstanceOfErr = mkIrredErr -- temporal way to show
diff --git a/compiler/typecheck/TcSimplify.hs b/compiler/typecheck/TcSimplify.hs
index cef26dc..94b5e2f 100644
--- a/compiler/typecheck/TcSimplify.hs
+++ b/compiler/typecheck/TcSimplify.hs
@@ -1696,6 +1696,7 @@ findDefaultableGroups :: ([Type], (Bool,Bool))
-> TcS [(TyVar, [Ct])]
findDefaultableGroups info wanteds
= do { simples <- approximateWC wanteds
+ ; traceTcS "findDefaultableGroups" (ppr simples)
; return (findDefaultableGroups_ info simples) }
findDefaultableGroups_
More information about the ghc-commits
mailing list