summaryrefslogtreecommitdiff
path: root/compiler/vectorise
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/vectorise
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/vectorise')
-rw-r--r--compiler/vectorise/Vectorise/Builtins/Initialise.hs4
-rw-r--r--compiler/vectorise/Vectorise/Exp.hs5
-rw-r--r--compiler/vectorise/Vectorise/Monad/Global.hs13
-rw-r--r--compiler/vectorise/Vectorise/Type/Env.hs5
4 files changed, 14 insertions, 13 deletions
diff --git a/compiler/vectorise/Vectorise/Builtins/Initialise.hs b/compiler/vectorise/Vectorise/Builtins/Initialise.hs
index 21de8dcb8b..69e00a0411 100644
--- a/compiler/vectorise/Vectorise/Builtins/Initialise.hs
+++ b/compiler/vectorise/Vectorise/Builtins/Initialise.hs
@@ -226,7 +226,7 @@ externalClass fs
= do { tycon <- dsLookupDPHRdrEnv (mkClsOccFS fs) >>= dsLookupTyCon
; case tyConClass_maybe tycon of
Nothing -> pprPanic "Vectorise.Builtins.Initialise" $
- ptext (sLit "Data.Array.Parallel.Prim.") <>
- ftext fs <+> ptext (sLit "is not a type class")
+ text "Data.Array.Parallel.Prim." <>
+ ftext fs <+> text "is not a type class"
Just cls -> return cls
}
diff --git a/compiler/vectorise/Vectorise/Exp.hs b/compiler/vectorise/Vectorise/Exp.hs
index fd1db9a7f8..5f283c6d3a 100644
--- a/compiler/vectorise/Vectorise/Exp.hs
+++ b/compiler/vectorise/Vectorise/Exp.hs
@@ -592,7 +592,7 @@ vectDictExpr (Case e bndr ty alts)
--
vectDictAltCon (DataAlt datacon) = DataAlt <$> maybeV dataConErr (lookupDataCon datacon)
where
- dataConErr = ptext (sLit "Cannot vectorise data constructor:") <+> ppr datacon
+ dataConErr = text "Cannot vectorise data constructor:" <+> ppr datacon
vectDictAltCon (LitAlt lit) = return $ LitAlt lit
vectDictAltCon DEFAULT = return DEFAULT
vectDictExpr (Let bnd body)
@@ -637,7 +637,8 @@ mkScalarFun arg_tys res_ty expr
; return (vExpr, unused)
}
| otherwise
- = do { traceVt "mkScalarFun: " $ ppr expr $$ ptext (sLit " ::") <+> ppr (mkFunTys arg_tys res_ty)
+ = do { traceVt "mkScalarFun: " $ ppr expr $$ text " ::" <+>
+ ppr (mkFunTys arg_tys res_ty)
; fn_var <- hoistExpr (fsLit "fn") expr DontInline
; zipf <- zipScalars arg_tys res_ty
diff --git a/compiler/vectorise/Vectorise/Monad/Global.hs b/compiler/vectorise/Vectorise/Monad/Global.hs
index 2ad0059596..0d3e0c0c91 100644
--- a/compiler/vectorise/Vectorise/Monad/Global.hs
+++ b/compiler/vectorise/Vectorise/Monad/Global.hs
@@ -47,7 +47,6 @@ import Name
import VarEnv
import VarSet
import Var as Var
-import FastString
import Outputable
@@ -100,11 +99,11 @@ defGlobalVar v v'
}
where
moduleOf var var' | var == var'
- = ptext (sLit "vectorises to itself")
+ = text "vectorises to itself"
| Just mod <- nameModule_maybe (Var.varName var')
- = ptext (sLit "in module") <+> ppr mod
+ = text "in module" <+> ppr mod
| otherwise
- = ptext (sLit "in the current module")
+ = text "in the current module"
-- |Remove the mapping of a variable in the vectorisation map.
--
@@ -180,11 +179,11 @@ defTyConName tc nameOfTc' tc'
}
where
moduleOf tc tc' | tc == tc'
- = ptext (sLit "vectorises to itself")
+ = text "vectorises to itself"
| Just mod <- nameModule_maybe (tyConName tc')
- = ptext (sLit "in module") <+> ppr mod
+ = text "in module" <+> ppr mod
| otherwise
- = ptext (sLit "in the current module")
+ = text "in the current module"
-- |Add a mapping between plain and vectorised `TyCon`s to the global environment.
--
diff --git a/compiler/vectorise/Vectorise/Type/Env.hs b/compiler/vectorise/Vectorise/Type/Env.hs
index e4b538ac34..7b00a5c1ef 100644
--- a/compiler/vectorise/Vectorise/Type/Env.hs
+++ b/compiler/vectorise/Vectorise/Type/Env.hs
@@ -232,8 +232,9 @@ vectTypeEnv tycons vectTypeDecls vectClassDecls
; traceVt " convert : " $ ppr conv_tcs
-- warn the user about unvectorised type constructors
- ; let explanation = ptext (sLit "(They use unsupported language extensions") $$
- ptext (sLit "or depend on type constructors that are not vectorised)")
+ ; let explanation = text "(They use unsupported language extensions"
+ $$ text "or depend on type constructors that are" <+>
+ text "not vectorised)"
drop_tcs_nosyn = filter (not . isTypeFamilyTyCon) .
filter (not . isTypeSynonymTyCon) $ drop_tcs
; unless (null drop_tcs_nosyn) $