From be97d35b91db37fed3f5a4ea1f6efc538e3daaaa Mon Sep 17 00:00:00 2001 From: simonpj Date: Wed, 26 May 1999 16:54:26 +0000 Subject: [PATCH 1/1] [project @ 1999-05-26 16:54:22 by simonpj] Minor improvements in error messages --- ghc/compiler/rename/RnSource.lhs | 3 +-- ghc/compiler/typecheck/TcExpr.lhs | 3 ++- ghc/compiler/types/PprType.lhs | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ghc/compiler/rename/RnSource.lhs b/ghc/compiler/rename/RnSource.lhs index 9044b87..68b817f 100644 --- a/ghc/compiler/rename/RnSource.lhs +++ b/ghc/compiler/rename/RnSource.lhs @@ -886,8 +886,7 @@ forAllErr doc ty tyvar (ptext SLIT("In") <+> doc)) ctxtErr explicit_forall doc tyvars constraint ty - = sep [ptext SLIT("None of the type variable(s) in the constraint") <+> quotes (pprClassAssertion constraint) <+> - ptext SLIT("does not mention any of"), + = sep [ptext SLIT("None of the type variable(s) in the constraint") <+> quotes (pprClassAssertion constraint), if explicit_forall then nest 4 (ptext SLIT("is universally quantified (i.e. bound by the forall)")) else diff --git a/ghc/compiler/typecheck/TcExpr.lhs b/ghc/compiler/typecheck/TcExpr.lhs index e2599cf..a27b3b0 100644 --- a/ghc/compiler/typecheck/TcExpr.lhs +++ b/ghc/compiler/typecheck/TcExpr.lhs @@ -159,7 +159,8 @@ tcPolyExpr arg expected_arg_ty returnTc ( generalised_arg, free_insts, arg', sig_tau, lie_arg ) where - sig_msg ty = ptext SLIT("In an expression with expected type:") <+> ppr ty + sig_msg ty = sep [ptext SLIT("In an expression with expected type:"), + nest 4 (ppr ty)] \end{code} %************************************************************************ diff --git a/ghc/compiler/types/PprType.lhs b/ghc/compiler/types/PprType.lhs index 8c29300..6b1b905 100644 --- a/ghc/compiler/types/PprType.lhs +++ b/ghc/compiler/types/PprType.lhs @@ -170,7 +170,7 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _) -- The type checker occasionally prints a type in an error message, -- and it had better come out looking like a user type sep [ ptext SLIT("forall") <+> pp_tyvars <> ptext SLIT("."), - ppr_theta theta <+> ptext SLIT("=>"), + ppr_theta theta, ppr_ty env tOP_PREC tau ] where @@ -179,7 +179,10 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _) pp_tyvars = hsep (map (pBndr env LambdaBind) tyvars) - ppr_theta theta = parens (hsep (punctuate comma (map ppr_dict theta))) + ppr_theta [] = empty + ppr_theta theta = parens (hsep (punctuate comma (map ppr_dict theta))) + <+> ptext SLIT("=>") + ppr_dict (clas,tys) = ppr clas <+> hsep (map (ppr_ty env tYCON_PREC) tys) -- 1.7.10.4