summaryrefslogtreecommitdiff
path: root/compiler/main/Packages.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/Packages.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/Packages.hs')
-rw-r--r--compiler/main/Packages.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/main/Packages.hs b/compiler/main/Packages.hs
index e22bf93656..cf181046f0 100644
--- a/compiler/main/Packages.hs
+++ b/compiler/main/Packages.hs
@@ -722,17 +722,17 @@ findWiredInPackages dflags pkgs vis_map = do
where
notfound = do
debugTraceMsg dflags 2 $
- ptext (sLit "wired-in package ")
+ text "wired-in package "
<> text wired_pkg
- <> ptext (sLit " not found.")
+ <> text " not found."
return Nothing
pick :: PackageConfig
-> IO (Maybe PackageConfig)
pick pkg = do
debugTraceMsg dflags 2 $
- ptext (sLit "wired-in package ")
+ text "wired-in package "
<> text wired_pkg
- <> ptext (sLit " mapped to ")
+ <> text " mapped to "
<> ppr (unitId pkg)
return (Just pkg)
@@ -801,7 +801,7 @@ type UnusablePackages = Map UnitId
pprReason :: SDoc -> UnusablePackageReason -> SDoc
pprReason pref reason = case reason of
IgnoredWithFlag ->
- pref <+> ptext (sLit "ignored due to an -ignore-package flag")
+ pref <+> text "ignored due to an -ignore-package flag"
MissingDependencies is_shadowed deps ->
pref <+> text "unusable due to"
<+> (if is_shadowed then text "shadowed"
@@ -815,7 +815,7 @@ reportUnusable dflags pkgs = mapM_ report (Map.toList pkgs)
report (ipid, (_, reason)) =
debugTraceMsg dflags 2 $
pprReason
- (ptext (sLit "package") <+> ppr ipid <+> text "is") reason
+ (text "package" <+> ppr ipid <+> text "is") reason
-- ----------------------------------------------------------------------------
--
@@ -1445,12 +1445,12 @@ add_package pkg_db ps (p, mb_parent)
= add_package pkg_db ps (key, Just p)
missingPackageMsg :: Outputable pkgid => pkgid -> SDoc
-missingPackageMsg p = ptext (sLit "unknown package:") <+> ppr p
+missingPackageMsg p = text "unknown package:" <+> ppr p
missingDependencyMsg :: Maybe UnitId -> SDoc
missingDependencyMsg Nothing = Outputable.empty
missingDependencyMsg (Just parent)
- = space <> parens (ptext (sLit "dependency of") <+> ftext (unitIdFS parent))
+ = space <> parens (text "dependency of" <+> ftext (unitIdFS parent))
-- -----------------------------------------------------------------------------