Commit be97d35b authored by simonpj's avatar simonpj
Browse files

[project @ 1999-05-26 16:54:22 by simonpj]

Minor improvements in error messages
parent 451a8613
...@@ -886,8 +886,7 @@ forAllErr doc ty tyvar ...@@ -886,8 +886,7 @@ forAllErr doc ty tyvar
(ptext SLIT("In") <+> doc)) (ptext SLIT("In") <+> doc))
ctxtErr explicit_forall doc tyvars constraint ty ctxtErr explicit_forall doc tyvars constraint ty
= sep [ptext SLIT("None of the type variable(s) in the constraint") <+> quotes (pprClassAssertion constraint) <+> = sep [ptext SLIT("None of the type variable(s) in the constraint") <+> quotes (pprClassAssertion constraint),
ptext SLIT("does not mention any of"),
if explicit_forall then if explicit_forall then
nest 4 (ptext SLIT("is universally quantified (i.e. bound by the forall)")) nest 4 (ptext SLIT("is universally quantified (i.e. bound by the forall)"))
else else
......
...@@ -159,7 +159,8 @@ tcPolyExpr arg expected_arg_ty ...@@ -159,7 +159,8 @@ tcPolyExpr arg expected_arg_ty
returnTc ( generalised_arg, free_insts, returnTc ( generalised_arg, free_insts,
arg', sig_tau, lie_arg ) arg', sig_tau, lie_arg )
where 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} \end{code}
%************************************************************************ %************************************************************************
......
...@@ -170,7 +170,7 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _) ...@@ -170,7 +170,7 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _)
-- The type checker occasionally prints a type in an error message, -- The type checker occasionally prints a type in an error message,
-- and it had better come out looking like a user type -- and it had better come out looking like a user type
sep [ ptext SLIT("forall") <+> pp_tyvars <> ptext SLIT("."), sep [ ptext SLIT("forall") <+> pp_tyvars <> ptext SLIT("."),
ppr_theta theta <+> ptext SLIT("=>"), ppr_theta theta,
ppr_ty env tOP_PREC tau ppr_ty env tOP_PREC tau
] ]
where where
...@@ -179,7 +179,10 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _) ...@@ -179,7 +179,10 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _)
pp_tyvars = hsep (map (pBndr env LambdaBind) tyvars) pp_tyvars = hsep (map (pBndr env LambdaBind) tyvars)
ppr_theta [] = empty
ppr_theta theta = parens (hsep (punctuate comma (map ppr_dict theta))) 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) ppr_dict (clas,tys) = ppr clas <+> hsep (map (ppr_ty env tYCON_PREC) tys)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment