summaryrefslogtreecommitdiff
path: root/compiler/deSugar/MatchLit.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/deSugar/MatchLit.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/deSugar/MatchLit.hs')
-rw-r--r--compiler/deSugar/MatchLit.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/deSugar/MatchLit.hs b/compiler/deSugar/MatchLit.hs
index 301d3a69e2..2fab8750af 100644
--- a/compiler/deSugar/MatchLit.hs
+++ b/compiler/deSugar/MatchLit.hs
@@ -139,9 +139,9 @@ warnAboutIdentities dflags (Var conv_fn) type_of_conv
, idName conv_fn `elem` conversionNames
, Just (arg_ty, res_ty) <- splitFunTy_maybe type_of_conv
, arg_ty `eqType` res_ty -- So we are converting ty -> ty
- = warnDs (vcat [ ptext (sLit "Call of") <+> ppr conv_fn <+> dcolon <+> ppr type_of_conv
- , nest 2 $ ptext (sLit "can probably be omitted")
- , parens (ptext (sLit "Use -fno-warn-identities to suppress this message"))
+ = warnDs (vcat [ text "Call of" <+> ppr conv_fn <+> dcolon <+> ppr type_of_conv
+ , nest 2 $ text "can probably be omitted"
+ , parens (text "Use -fno-warn-identities to suppress this message")
])
warnAboutIdentities _ _ _ = return ()
@@ -173,9 +173,9 @@ warnAboutOverflowedLiterals dflags lit
check :: forall a. (Bounded a, Integral a) => Integer -> Name -> a -> DsM ()
check i tc _proxy
= when (i < minB || i > maxB) $ do
- warnDs (vcat [ ptext (sLit "Literal") <+> integer i
- <+> ptext (sLit "is out of the") <+> ppr tc <+> ptext (sLit "range")
- <+> integer minB <> ptext (sLit "..") <> integer maxB
+ warnDs (vcat [ text "Literal" <+> integer i
+ <+> text "is out of the" <+> ppr tc <+> ptext (sLit "range")
+ <+> integer minB <> text ".." <> integer maxB
, sug ])
where
minB = toInteger (minBound :: a)
@@ -183,7 +183,7 @@ warnAboutOverflowedLiterals dflags lit
sug | minB == -i -- Note [Suggest NegativeLiterals]
, i > 0
, not (xopt LangExt.NegativeLiterals dflags)
- = ptext (sLit "If you are trying to write a large negative literal, use NegativeLiterals")
+ = text "If you are trying to write a large negative literal, use NegativeLiterals"
| otherwise = Outputable.empty
{-
@@ -209,7 +209,7 @@ warnAboutEmptyEnumerations dflags fromExpr mThnExpr toExpr
, let check :: forall a. (Enum a, Num a) => a -> DsM ()
check _proxy
= when (null enumeration) $
- warnDs (ptext (sLit "Enumeration is empty"))
+ warnDs (text "Enumeration is empty")
where
enumeration :: [a]
enumeration = case mThn of