summaryrefslogtreecommitdiff
path: root/compiler/rename
diff options
context:
space:
mode:
authorGeoffrey Mainland <mainland@apeiron.net>2013-05-16 15:11:36 +0100
committerGeoffrey Mainland <mainland@apeiron.net>2013-10-04 17:22:48 -0400
commit1e6a9410911475d5afb57fb4e6b6b29d85a1e13e (patch)
tree31b5191941010e52e146b2c9567d470a63ec397a /compiler/rename
parent96c6fa00daff145f35193e3506157b40e44f7ed3 (diff)
downloadhaskell-1e6a9410911475d5afb57fb4e6b6b29d85a1e13e.tar.gz
Clean up error context when checking brackets/splices.
Diffstat (limited to 'compiler/rename')
-rw-r--r--compiler/rename/RnSplice.lhs8
1 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rename/RnSplice.lhs b/compiler/rename/RnSplice.lhs
index 0d56df199f..ee9b25678a 100644
--- a/compiler/rename/RnSplice.lhs
+++ b/compiler/rename/RnSplice.lhs
@@ -218,8 +218,7 @@ rnSpliceExpr splice@(HsSplice isTypedSplice _ expr)
\begin{code}
rnBracket :: HsExpr RdrName -> HsBracket RdrName -> RnM (HsExpr Name, FreeVars)
rnBracket e br_body
- = addErrCtxt (hang (ptext (sLit "In the Template Haskell quotation"))
- 2 (ppr br_body)) $
+ = addErrCtxt (quotationCtxtDoc br_body) $
do { -- Check that Template Haskell is enabled and available
thEnabled <- xoptM Opt_TemplateHaskell
; unless thEnabled $
@@ -369,6 +368,11 @@ quotedNameStageErr br
= sep [ ptext (sLit "Stage error: the non-top-level quoted name") <+> ppr br
, ptext (sLit "must be used at the same stage at which is is bound")]
+quotationCtxtDoc :: HsBracket RdrName -> SDoc
+quotationCtxtDoc br_body
+ = hang (ptext (sLit "In the Template Haskell quotation"))
+ 2 (ppr br_body)
+
spliceResultDoc :: OutputableBndr id => LHsExpr id -> SDoc
spliceResultDoc expr
= sep [ ptext (sLit "In the result of the splice:")