summaryrefslogtreecommitdiff
path: root/compiler/main/GhcMake.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/main/GhcMake.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/main/GhcMake.hs')
-rw-r--r--compiler/main/GhcMake.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 9c6abb89e6..7bbe4be495 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -1560,7 +1560,7 @@ warnUnnecessarySourceImports sccs = do
warn :: DynFlags -> Located ModuleName -> WarnMsg
warn dflags (L loc mod) =
mkPlainErrMsg dflags loc
- (ptext (sLit "Warning: {-# SOURCE #-} unnecessary in import of ")
+ (text "Warning: {-# SOURCE #-} unnecessary in import of "
<+> quotes (ppr mod))
@@ -2038,8 +2038,8 @@ cyclicModuleErr :: [ModSummary] -> SDoc
cyclicModuleErr mss
= ASSERT( not (null mss) )
case findCycle graph of
- Nothing -> ptext (sLit "Unexpected non-cycle") <+> ppr mss
- Just path -> vcat [ ptext (sLit "Module imports form a cycle:")
+ Nothing -> text "Unexpected non-cycle" <+> ppr mss
+ Just path -> vcat [ text "Module imports form a cycle:"
, nest 2 (show_path path) ]
where
graph :: [Node NodeKey ModSummary]
@@ -2050,14 +2050,14 @@ cyclicModuleErr mss
[ (unLoc m, NotBoot) | m <- ms_home_imps ms ])
show_path [] = panic "show_path"
- show_path [m] = ptext (sLit "module") <+> ppr_ms m
- <+> ptext (sLit "imports itself")
- show_path (m1:m2:ms) = vcat ( nest 7 (ptext (sLit "module") <+> ppr_ms m1)
- : nest 6 (ptext (sLit "imports") <+> ppr_ms m2)
+ show_path [m] = text "module" <+> ppr_ms m
+ <+> text "imports itself"
+ show_path (m1:m2:ms) = vcat ( nest 7 (text "module" <+> ppr_ms m1)
+ : nest 6 (text "imports" <+> ppr_ms m2)
: go ms )
where
- go [] = [ptext (sLit "which imports") <+> ppr_ms m1]
- go (m:ms) = (ptext (sLit "which imports") <+> ppr_ms m) : go ms
+ go [] = [text "which imports" <+> ppr_ms m1]
+ go (m:ms) = (text "which imports" <+> ppr_ms m) : go ms
ppr_ms :: ModSummary -> SDoc