X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcSplice.lhs;h=70eaca8cec7cde7ff38961176ebcc907035d5719;hb=dc07de316fa7730abe8759b57bd8300e07650f3a;hp=651d44c6c306ad9c1292aaf0854f60de79cdd1a2;hpb=2e4cc75af2b8af9c971702de78b63c7c1a1a1a35;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcSplice.lhs b/compiler/typecheck/TcSplice.lhs index 651d44c..70eaca8 100644 --- a/compiler/typecheck/TcSplice.lhs +++ b/compiler/typecheck/TcSplice.lhs @@ -438,10 +438,17 @@ tcTopSplice expr res_ty -- Rename it, but bale out if there are errors -- otherwise the type checker just gives more spurious errors - ; (exp3, _fvs) <- checkNoErrs (rnLExpr expr2) + ; addErrCtxt (spliceResultDoc expr) $ do + { (exp3, _fvs) <- checkNoErrs (rnLExpr expr2) - ; exp4 <- tcMonoExpr exp3 res_ty - ; return (unLoc exp4) } + ; exp4 <- tcMonoExpr exp3 res_ty + ; return (unLoc exp4) } } + +spliceResultDoc :: LHsExpr Name -> SDoc +spliceResultDoc expr + = sep [ ptext (sLit "In the result of the splice:") + , nest 2 (char '$' <> pprParendExpr expr) + , ptext (sLit "To see what the splice expanded to, use -ddump-splices")] ------------------- tcTopSpliceExpr :: TcM (LHsExpr Id) -> TcM (LHsExpr Id) @@ -522,11 +529,11 @@ kcTopSpliceType expr -- Rename it, but bale out if there are errors -- otherwise the type checker just gives more spurious errors - ; let doc = ptext (sLit "In the spliced type") <+> ppr hs_ty2 + ; addErrCtxt (spliceResultDoc expr) $ do + { let doc = ptext (sLit "In the spliced type") <+> ppr hs_ty2 ; hs_ty3 <- checkNoErrs (rnLHsType doc hs_ty2) - ; (ty4, kind) <- kcLHsType hs_ty3 - ; return (unLoc ty4, kind) } + ; return (unLoc ty4, kind) }} \end{code} %************************************************************************