X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcDeriv.lhs;h=22168fce6ba67257b6c6f1e04503032ea610444b;hp=95d9697c0c67f716b970a85add2b890e733fd918;hb=5f0c4f9aa291cdc291fcdc0c4a30fdce1f91230d;hpb=9ebd6baeb3955a9f3daa9b57a3d1b8f3b328893d diff --git a/compiler/typecheck/TcDeriv.lhs b/compiler/typecheck/TcDeriv.lhs index 95d9697..22168fc 100644 --- a/compiler/typecheck/TcDeriv.lhs +++ b/compiler/typecheck/TcDeriv.lhs @@ -729,9 +729,9 @@ solveDerivEqns overlap_flag orig_eqns gen_soln (_, clas, tc,tyvars,deriv_rhs) = setSrcSpan (srcLocSpan (getSrcLoc tc)) $ do { let inst_tys = [mkTyConApp tc (mkTyVarTys tyvars)] - ; theta <- addErrCtxt (derivInstCtxt [] clas inst_tys) $ + ; theta <- addErrCtxt (derivInstCtxt1 clas inst_tys) $ tcSimplifyDeriv tc tyvars deriv_rhs - ; addErrCtxt (derivInstCtxt theta clas inst_tys) $ + ; addErrCtxt (derivInstCtxt2 theta clas inst_tys) $ checkValidInstance tyvars theta clas inst_tys ; return (sortLe (<=) theta) } -- Canonicalise before returning the soluction where @@ -960,8 +960,12 @@ derivCtxt :: TyCon -> SDoc derivCtxt tycon = ptext SLIT("When deriving instances for") <+> quotes (ppr tycon) -derivInstCtxt theta clas inst_tys - = hang (ptext SLIT("In the derived instance")) - 2 (ptext SLIT("instance") <+> sep [pprThetaArrow theta, pprClassPred clas inst_tys]) +derivInstCtxt1 clas inst_tys + = ptext SLIT("When deriving the instance for") <+> quotes (pprClassPred clas inst_tys) + +derivInstCtxt2 theta clas inst_tys + = vcat [ptext SLIT("In the derived instance declaration"), + nest 2 (ptext SLIT("instance") <+> sep [pprThetaArrow theta, + pprClassPred clas inst_tys])] \end{code}