summaryrefslogtreecommitdiff
path: root/compiler/typecheck/Inst.hs
diff options
context:
space:
mode:
authorJan Stolarek <jan.stolarek@p.lodz.pl>2016-01-15 18:24:14 +0100
committerJan Stolarek <jan.stolarek@p.lodz.pl>2016-01-18 18:54:10 +0100
commitb8abd852d3674cb485490d2b2e94906c06ee6e8f (patch)
treeeddf226b9c10be8b9b982ed29c1ef61841755c6f /compiler/typecheck/Inst.hs
parent817dd925569d981523bbf4fb471014d46c51c7db (diff)
downloadhaskell-b8abd852d3674cb485490d2b2e94906c06ee6e8f.tar.gz
Replace calls to `ptext . sLit` with `text`
Summary: In the past the canonical way for constructing an SDoc string literal was the composition `ptext . sLit`. But for some time now we have function `text` that does the same. Plus it has some rules that optimize its runtime behaviour. This patch takes all uses of `ptext . sLit` in the compiler and replaces them with calls to `text`. The main benefits of this patch are clener (shorter) code and less dependencies between module, because many modules now do not need to import `FastString`. I don't expect any performance benefits - we mostly use SDocs to report errors and it seems there is little to be gained here. Test Plan: ./validate Reviewers: bgamari, austin, goldfire, hvr, alanz Subscribers: goldfire, thomie, mpickering Differential Revision: https://phabricator.haskell.org/D1784
Diffstat (limited to 'compiler/typecheck/Inst.hs')
-rw-r--r--compiler/typecheck/Inst.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/typecheck/Inst.hs b/compiler/typecheck/Inst.hs
index 8878ba6b46..43f7f1eba7 100644
--- a/compiler/typecheck/Inst.hs
+++ b/compiler/typecheck/Inst.hs
@@ -467,9 +467,9 @@ syntaxNameCtxt :: HsExpr Name -> CtOrigin -> Type -> TidyEnv
-> TcRn (TidyEnv, SDoc)
syntaxNameCtxt name orig ty tidy_env
= do { inst_loc <- getCtLocM orig (Just TypeLevel)
- ; let msg = vcat [ ptext (sLit "When checking that") <+> quotes (ppr name)
- <+> ptext (sLit "(needed by a syntactic construct)")
- , nest 2 (ptext (sLit "has the required type:")
+ ; let msg = vcat [ text "When checking that" <+> quotes (ppr name)
+ <+> text "(needed by a syntactic construct)"
+ , nest 2 (text "has the required type:"
<+> ppr (tidyType tidy_env ty))
, nest 2 (pprCtLoc inst_loc) ]
; return (tidy_env, msg) }
@@ -524,7 +524,7 @@ newClsInst overlap_mode dfun_name tvs theta clas tys
instOrphWarn :: ClsInst -> SDoc
instOrphWarn inst
- = hang (ptext (sLit "Orphan instance:")) 2 (pprInstanceHdr inst)
+ = hang (text "Orphan instance:") 2 (pprInstanceHdr inst)
$$ text "To avoid this"
$$ nest 4 (vcat possibilities)
where
@@ -656,12 +656,12 @@ traceDFuns ispecs
funDepErr :: ClsInst -> [ClsInst] -> TcRn ()
funDepErr ispec ispecs
- = addClsInstsErr (ptext (sLit "Functional dependencies conflict between instance declarations:"))
+ = addClsInstsErr (text "Functional dependencies conflict between instance declarations:")
(ispec : ispecs)
dupInstErr :: ClsInst -> ClsInst -> TcRn ()
dupInstErr ispec dup_ispec
- = addClsInstsErr (ptext (sLit "Duplicate instance declarations:"))
+ = addClsInstsErr (text "Duplicate instance declarations:")
[ispec, dup_ispec]
addClsInstsErr :: SDoc -> [ClsInst] -> TcRn ()