diff options
author | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2016-01-15 18:24:14 +0100 |
---|---|---|
committer | Jan Stolarek <jan.stolarek@p.lodz.pl> | 2016-01-18 18:54:10 +0100 |
commit | b8abd852d3674cb485490d2b2e94906c06ee6e8f (patch) | |
tree | eddf226b9c10be8b9b982ed29c1ef61841755c6f /compiler/iface | |
parent | 817dd925569d981523bbf4fb471014d46c51c7db (diff) | |
download | haskell-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/iface')
-rw-r--r-- | compiler/iface/IfaceSyn.hs | 114 | ||||
-rw-r--r-- | compiler/iface/IfaceType.hs | 16 | ||||
-rw-r--r-- | compiler/iface/LoadIface.hs | 102 | ||||
-rw-r--r-- | compiler/iface/MkIface.hs | 24 | ||||
-rw-r--r-- | compiler/iface/TcIface.hs | 48 |
5 files changed, 152 insertions, 152 deletions
diff --git a/compiler/iface/IfaceSyn.hs b/compiler/iface/IfaceSyn.hs index 6f26e231de..7b6b34c728 100644 --- a/compiler/iface/IfaceSyn.hs +++ b/compiler/iface/IfaceSyn.hs @@ -527,7 +527,7 @@ pprAxBranch pp_tc (IfaceAxBranch { ifaxbTyVars = tvs pprWithCommas pprIfaceIdBndr cvs) pp_lhs = hang pp_tc 2 (pprParendIfaceTcArgs pat_tys) maybe_incomps = ppUnless (null incomps) $ parens $ - ptext (sLit "incompatible indices:") <+> ppr incomps + text "incompatible indices:" <+> ppr incomps instance Outputable IfaceAnnotation where ppr (IfaceAnnotation target value) = ppr target <+> colon <+> ppr value @@ -609,7 +609,7 @@ ppr_trim xs where go (Just doc) (_, so_far) = (False, doc : so_far) go Nothing (True, so_far) = (True, so_far) - go Nothing (False, so_far) = (True, ptext (sLit "...") : so_far) + go Nothing (False, so_far) = (True, text "..." : so_far) isIfaceDataInstance :: IfaceTyConParent -> Bool isIfaceDataInstance IfNoParent = False @@ -637,12 +637,12 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype, gadt_style = gadt || any (not . isVanillaIfaceConDecl) cons cons = visibleIfConDecls condecls - pp_where = ppWhen (gadt_style && not (null cons)) $ ptext (sLit "where") + pp_where = ppWhen (gadt_style && not (null cons)) $ text "where" pp_cons = ppr_trim (map show_con cons) :: [SDoc] pp_lhs = case parent of IfNoParent -> pprIfaceDeclHead context ss tycon kind tc_tyvars - _ -> ptext (sLit "instance") <+> pprIfaceTyConParent parent + _ -> text "instance" <+> pprIfaceTyConParent parent pp_roles | is_data_instance = empty @@ -682,9 +682,9 @@ pprIfaceDecl ss (IfaceData { ifName = tycon, ifCType = ctype, (tc_bndrs, _, _) = splitIfaceSigmaTy kind pp_nd = case condecls of - IfAbstractTyCon d -> ptext (sLit "abstract") <> ppShowIface ss (parens (ppr d)) - IfDataTyCon{} -> ptext (sLit "data") - IfNewTyCon{} -> ptext (sLit "newtype") + IfAbstractTyCon d -> text "abstract" <> ppShowIface ss (parens (ppr d)) + IfDataTyCon{} -> text "data" + IfNewTyCon{} -> text "newtype" pp_extra = vcat [pprCType ctype, pprRec isrec, text "Kind:" <+> ppr kind] @@ -695,14 +695,14 @@ pprIfaceDecl ss (IfaceClass { ifATs = ats, ifSigs = sigs, ifRec = isrec , ifFDs = fds, ifMinDef = minDef , ifKind = kind }) = vcat [ pprRoles (== Nominal) (pprPrefixIfDeclBndr ss clas) bndrs roles - , ptext (sLit "class") <+> pprIfaceDeclHead context ss clas kind tyvars + , text "class" <+> pprIfaceDeclHead context ss clas kind tyvars <+> pprFundeps fds <+> pp_where , nest 2 (vcat [ vcat asocs, vcat dsigs, pprec , ppShowAllSubs ss (pprMinDef minDef)])] where (bndrs, _, _) = splitIfaceSigmaTy kind - pp_where = ppShowRhs ss $ ppUnless (null sigs && null ats) (ptext (sLit "where")) + pp_where = ppShowRhs ss $ ppUnless (null sigs && null ats) (text "where") asocs = ppr_trim $ map maybeShowAssoc ats dsigs = ppr_trim $ map maybeShowSig sigs @@ -720,16 +720,16 @@ pprIfaceDecl ss (IfaceClass { ifATs = ats, ifSigs = sigs, ifRec = isrec pprMinDef :: BooleanFormula IfLclName -> SDoc pprMinDef minDef = ppUnless (isTrue minDef) $ -- hide empty definitions - ptext (sLit "{-# MINIMAL") <+> + text "{-# MINIMAL" <+> pprBooleanFormula (\_ def -> cparen (isLexSym def) (ppr def)) 0 minDef <+> - ptext (sLit "#-}") + text "#-}" pprIfaceDecl ss (IfaceSynonym { ifName = tc , ifTyVars = tv , ifSynRhs = mono_ty , ifSynKind = kind}) - = hang (ptext (sLit "type") <+> pprIfaceDeclHead [] ss tc kind tv <+> equals) + = hang (text "type" <+> pprIfaceDeclHead [] ss tc kind tv <+> equals) 2 (sep [pprIfaceForAll tvs, pprIfaceContextArr theta, ppr tau]) where (tvs, theta, tau) = splitIfaceSigmaTy mono_ty @@ -738,7 +738,7 @@ pprIfaceDecl ss (IfaceFamily { ifName = tycon, ifTyVars = tyvars , ifFamFlav = rhs, ifFamKind = kind , ifResVar = res_var, ifFamInj = inj }) | IfaceDataFamilyTyCon <- rhs - = ptext (sLit "data family") <+> pprIfaceDeclHead [] ss tycon kind tyvars + = text "data family" <+> pprIfaceDeclHead [] ss tycon kind tyvars | otherwise = hang (text "type family" <+> pprIfaceDeclHead [] ss tycon kind tyvars) @@ -758,20 +758,20 @@ pprIfaceDecl ss (IfaceFamily { ifName = tycon, ifTyVars = tyvars tvs -> hsep [vbar, ppr res, text "->", interppSP (map fst tvs)] pp_rhs IfaceDataFamilyTyCon - = ppShowIface ss (ptext (sLit "data")) + = ppShowIface ss (text "data") pp_rhs IfaceOpenSynFamilyTyCon - = ppShowIface ss (ptext (sLit "open")) + = ppShowIface ss (text "open") pp_rhs IfaceAbstractClosedSynFamilyTyCon - = ppShowIface ss (ptext (sLit "closed, abstract")) + = ppShowIface ss (text "closed, abstract") pp_rhs (IfaceClosedSynFamilyTyCon {}) = empty -- see pp_branches pp_rhs IfaceBuiltInSynFamTyCon - = ppShowIface ss (ptext (sLit "built-in")) + = ppShowIface ss (text "built-in") pp_branches (IfaceClosedSynFamilyTyCon (Just (ax, brs))) = hang (text "where") 2 (vcat (map (pprAxBranch (pprPrefixIfDeclBndr ss tycon)) brs) - $$ ppShowIface ss (ptext (sLit "axiom") <+> ppr ax)) + $$ ppShowIface ss (text "axiom" <+> ppr ax)) pp_branches _ = Outputable.empty pprIfaceDecl _ (IfacePatSyn { ifName = name, ifPatBuilder = builder, @@ -798,13 +798,13 @@ pprIfaceDecl ss (IfaceId { ifName = var, ifType = ty, pprIfaceDecl _ (IfaceAxiom { ifName = name, ifTyCon = tycon , ifAxBranches = branches }) - = hang (ptext (sLit "axiom") <+> ppr name <> dcolon) + = hang (text "axiom" <+> ppr name <> dcolon) 2 (vcat $ map (pprAxBranch (ppr tycon)) branches) pprCType :: Maybe CType -> SDoc pprCType Nothing = Outputable.empty -pprCType (Just cType) = ptext (sLit "C type:") <+> ppr cType +pprCType (Just cType) = text "C type:" <+> ppr cType -- if, for each role, suppress_if role is True, then suppress the role -- output @@ -814,11 +814,11 @@ pprRoles suppress_if tyCon bndrs roles = sdocWithDynFlags $ \dflags -> let froles = suppressIfaceInvisibles dflags bndrs roles in ppUnless (all suppress_if roles || null froles) $ - ptext (sLit "type role") <+> tyCon <+> hsep (map ppr froles) + text "type role" <+> tyCon <+> hsep (map ppr froles) pprRec :: RecFlag -> SDoc pprRec NonRecursive = Outputable.empty -pprRec Recursive = ptext (sLit "RecFlag: Recursive") +pprRec Recursive = text "RecFlag: Recursive" pprInfixIfDeclBndr, pprPrefixIfDeclBndr :: ShowSub -> OccName -> SDoc pprInfixIfDeclBndr (ShowSub { ss_ppr_bndr = ppr_bndr }) occ @@ -834,7 +834,7 @@ pprIfaceClassOp ss (IfaceClassOp n ty dm) = pp_sig n ty $$ generic_dm where generic_dm | Just (GenericDM dm_ty) <- dm - = ptext (sLit "default") <+> pp_sig n dm_ty + = text "default" <+> pp_sig n dm_ty | otherwise = empty pp_sig n ty = pprPrefixIfDeclBndr ss n <+> dcolon <+> pprIfaceSigmaType ty @@ -848,7 +848,7 @@ pprIfaceAT ss (IfaceAT d mb_def) , case mb_def of Nothing -> Outputable.empty Just rhs -> nest 2 $ - ptext (sLit "Default:") <+> ppr rhs ] + text "Default:" <+> ppr rhs ] instance Outputable IfaceTyConParent where ppr p = pprIfaceTyConParent p @@ -912,8 +912,8 @@ pprIfaceConDecl ss gadt_style mk_user_con_res_ty fls ppr_bang IfNoBang = ppWhen opt_PprStyle_Debug $ char '_' ppr_bang IfStrict = char '!' - ppr_bang IfUnpack = ptext (sLit "{-# UNPACK #-}") - ppr_bang (IfUnpackCo co) = ptext (sLit "! {-# UNPACK #-}") <> + ppr_bang IfUnpack = text "{-# UNPACK #-}" + ppr_bang (IfUnpackCo co) = text "! {-# UNPACK #-}" <> pprParendIfaceCoercion co pprParendBangTy (bang, ty) = ppr_bang bang <> pprParendIfaceType ty @@ -939,22 +939,22 @@ instance Outputable IfaceRule where ppr (IfaceRule { ifRuleName = name, ifActivation = act, ifRuleBndrs = bndrs, ifRuleHead = fn, ifRuleArgs = args, ifRuleRhs = rhs }) = sep [hsep [pprRuleName name, ppr act, - ptext (sLit "forall") <+> pprIfaceBndrs bndrs], + text "forall" <+> pprIfaceBndrs bndrs], nest 2 (sep [ppr fn <+> sep (map pprParendIfaceExpr args), - ptext (sLit "=") <+> ppr rhs]) + text "=" <+> ppr rhs]) ] instance Outputable IfaceClsInst where ppr (IfaceClsInst { ifDFun = dfun_id, ifOFlag = flag , ifInstCls = cls, ifInstTys = mb_tcs}) - = hang (ptext (sLit "instance") <+> ppr flag + = hang (text "instance" <+> ppr flag <+> ppr cls <+> brackets (pprWithCommas ppr_rough mb_tcs)) 2 (equals <+> ppr dfun_id) instance Outputable IfaceFamInst where ppr (IfaceFamInst { ifFamInstFam = fam, ifFamInstTys = mb_tcs , ifFamInstAxiom = tycon_ax}) - = hang (ptext (sLit "family instance") <+> + = hang (text "family instance" <+> ppr fam <+> pprWithCommas (brackets . ppr_rough) mb_tcs) 2 (equals <+> ppr tycon_ax) @@ -1024,37 +1024,37 @@ pprIfaceExpr add_par i@(IfaceLam _ _) collect bs e = (reverse bs, e) pprIfaceExpr add_par (IfaceECase scrut ty) - = add_par (sep [ ptext (sLit "case") <+> pprIfaceExpr noParens scrut - , ptext (sLit "ret_ty") <+> pprParendIfaceType ty - , ptext (sLit "of {}") ]) + = add_par (sep [ text "case" <+> pprIfaceExpr noParens scrut + , text "ret_ty" <+> pprParendIfaceType ty + , text "of {}" ]) pprIfaceExpr add_par (IfaceCase scrut bndr [(con, bs, rhs)]) - = add_par (sep [ptext (sLit "case") - <+> pprIfaceExpr noParens scrut <+> ptext (sLit "of") + = add_par (sep [text "case" + <+> pprIfaceExpr noParens scrut <+> text "of" <+> ppr bndr <+> char '{' <+> ppr_con_bs con bs <+> arrow, pprIfaceExpr noParens rhs <+> char '}']) pprIfaceExpr add_par (IfaceCase scrut bndr alts) - = add_par (sep [ptext (sLit "case") - <+> pprIfaceExpr noParens scrut <+> ptext (sLit "of") + = add_par (sep [text "case" + <+> pprIfaceExpr noParens scrut <+> text "of" <+> ppr bndr <+> char '{', nest 2 (sep (map ppr_alt alts)) <+> char '}']) pprIfaceExpr _ (IfaceCast expr co) = sep [pprParendIfaceExpr expr, - nest 2 (ptext (sLit "`cast`")), + nest 2 (text "`cast`"), pprParendIfaceCoercion co] pprIfaceExpr add_par (IfaceLet (IfaceNonRec b rhs) body) - = add_par (sep [ptext (sLit "let {"), + = add_par (sep [text "let {", nest 2 (ppr_bind (b, rhs)), - ptext (sLit "} in"), + text "} in", pprIfaceExpr noParens body]) pprIfaceExpr add_par (IfaceLet (IfaceRec pairs) body) - = add_par (sep [ptext (sLit "letrec {"), + = add_par (sep [text "letrec {", nest 2 (sep (map ppr_bind pairs)), - ptext (sLit "} in"), + text "} in", pprIfaceExpr noParens body]) pprIfaceExpr add_par (IfaceTick tickish e) @@ -1096,36 +1096,36 @@ instance Outputable IfaceConAlt where ------------------ instance Outputable IfaceIdDetails where ppr IfVanillaId = Outputable.empty - ppr (IfRecSelId tc b) = ptext (sLit "RecSel") <+> ppr tc + ppr (IfRecSelId tc b) = text "RecSel" <+> ppr tc <+> if b - then ptext (sLit "<naughty>") + then text "<naughty>" else Outputable.empty - ppr IfDFunId = ptext (sLit "DFunId") + ppr IfDFunId = text "DFunId" instance Outputable IfaceIdInfo where ppr NoInfo = Outputable.empty - ppr (HasInfo is) = ptext (sLit "{-") <+> pprWithCommas ppr is - <+> ptext (sLit "-}") + ppr (HasInfo is) = text "{-" <+> pprWithCommas ppr is + <+> text "-}" instance Outputable IfaceInfoItem where - ppr (HsUnfold lb unf) = ptext (sLit "Unfolding") - <> ppWhen lb (ptext (sLit "(loop-breaker)")) + ppr (HsUnfold lb unf) = text "Unfolding" + <> ppWhen lb (text "(loop-breaker)") <> colon <+> ppr unf - ppr (HsInline prag) = ptext (sLit "Inline:") <+> ppr prag - ppr (HsArity arity) = ptext (sLit "Arity:") <+> int arity - ppr (HsStrictness str) = ptext (sLit "Strictness:") <+> pprIfaceStrictSig str - ppr HsNoCafRefs = ptext (sLit "HasNoCafRefs") + ppr (HsInline prag) = text "Inline:" <+> ppr prag + ppr (HsArity arity) = text "Arity:" <+> int arity + ppr (HsStrictness str) = text "Strictness:" <+> pprIfaceStrictSig str + ppr HsNoCafRefs = text "HasNoCafRefs" instance Outputable IfaceUnfolding where - ppr (IfCompulsory e) = ptext (sLit "<compulsory>") <+> parens (ppr e) + ppr (IfCompulsory e) = text "<compulsory>" <+> parens (ppr e) ppr (IfCoreUnfold s e) = (if s - then ptext (sLit "<stable>") + then text "<stable>" else Outputable.empty) <+> parens (ppr e) - ppr (IfInlineRule a uok bok e) = sep [ptext (sLit "InlineRule") + ppr (IfInlineRule a uok bok e) = sep [text "InlineRule" <+> ppr (a,uok,bok), pprParendIfaceExpr e] - ppr (IfDFunUnfold bs es) = hang (ptext (sLit "DFun:") <+> sep (map ppr bs) <> dot) + ppr (IfDFunUnfold bs es) = hang (text "DFun:" <+> sep (map ppr bs) <> dot) 2 (sep (map pprParendIfaceExpr es)) {- diff --git a/compiler/iface/IfaceType.hs b/compiler/iface/IfaceType.hs index ac3f1b65db..09c7c6bb27 100644 --- a/compiler/iface/IfaceType.hs +++ b/compiler/iface/IfaceType.hs @@ -637,7 +637,7 @@ ppr_ty ctxt_prec (IfaceAppTy ty1 ty2) ppr_ty ctxt_prec (IfaceCastTy ty co) = maybeParen ctxt_prec FunPrec $ - sep [ppr_ty FunPrec ty, ptext (sLit "`cast`"), ppr_co FunPrec co] + sep [ppr_ty FunPrec ty, text "`cast`", ppr_co FunPrec co] ppr_ty ctxt_prec (IfaceCoercionTy co) = ppr_co ctxt_prec co @@ -778,7 +778,7 @@ pprTyTcApp :: TyPrec -> IfaceTyCon -> IfaceTcArgs -> DynFlags -> SDoc pprTyTcApp ctxt_prec tc tys dflags | ifaceTyConName tc `hasKey` ipClassKey , ITC_Vis (IfaceLitTy (IfaceStrTyLit n)) (ITC_Vis ty ITC_Nil) <- tys - = char '?' <> ftext n <> ptext (sLit "::") <> ppr_ty TopPrec ty + = char '?' <> ftext n <> text "::" <> ppr_ty TopPrec ty | ifaceTyConName tc == consDataConName , not (gopt Opt_PrintExplicitKinds dflags) @@ -873,7 +873,7 @@ ppr_co _ (IfaceCoVarCo covar) = ppr covar ppr_co ctxt_prec (IfaceUnivCo IfaceUnsafeCoerceProv r ty1 ty2) = maybeParen ctxt_prec TyConPrec $ - ptext (sLit "UnsafeCo") <+> ppr r <+> + text "UnsafeCo" <+> ppr r <+> pprParendIfaceType ty1 <+> pprParendIfaceType ty2 ppr_co _ (IfaceUnivCo _ _ ty1 ty2) @@ -881,7 +881,7 @@ ppr_co _ (IfaceUnivCo _ _ ty1 ty2) ppr_co ctxt_prec (IfaceInstCo co ty) = maybeParen ctxt_prec TyConPrec $ - ptext (sLit "Inst") <+> pprParendIfaceCoercion co + text "Inst" <+> pprParendIfaceCoercion co <+> pprParendIfaceCoercion ty ppr_co ctxt_prec (IfaceAxiomRuleCo tc cos) @@ -891,12 +891,12 @@ ppr_co ctxt_prec co = ppr_special_co ctxt_prec doc cos where (doc, cos) = case co of { IfaceAxiomInstCo n i cos -> (ppr n <> brackets (ppr i), cos) - ; IfaceSymCo co -> (ptext (sLit "Sym"), [co]) - ; IfaceTransCo co1 co2 -> (ptext (sLit "Trans"), [co1,co2]) - ; IfaceNthCo d co -> (ptext (sLit "Nth:") <> int d, + ; IfaceSymCo co -> (text "Sym", [co]) + ; IfaceTransCo co1 co2 -> (text "Trans", [co1,co2]) + ; IfaceNthCo d co -> (text "Nth:" <> int d, [co]) ; IfaceLRCo lr co -> (ppr lr, [co]) - ; IfaceSubCo co -> (ptext (sLit "Sub"), [co]) + ; IfaceSubCo co -> (text "Sub", [co]) ; _ -> panic "pprIfaceCo" } ppr_special_co :: TyPrec -> SDoc -> [IfaceCoercion] -> SDoc diff --git a/compiler/iface/LoadIface.hs b/compiler/iface/LoadIface.hs index 35c6b22027..c044136b36 100644 --- a/compiler/iface/LoadIface.hs +++ b/compiler/iface/LoadIface.hs @@ -141,11 +141,11 @@ importDecl name Nothing -> return (Failed not_found_msg) }}} where - nd_doc = ptext (sLit "Need decl for") <+> ppr name - not_found_msg = hang (ptext (sLit "Can't find interface-file declaration for") <+> + nd_doc = text "Need decl for" <+> ppr name + not_found_msg = hang (text "Can't find interface-file declaration for" <+> pprNameSpace (occNameSpace (nameOccName name)) <+> ppr name) - 2 (vcat [ptext (sLit "Probable cause: bug in .hi-boot file, or inconsistent .hi file"), - ptext (sLit "Use -ddump-if-trace to get an idea of which file caused the error")]) + 2 (vcat [text "Probable cause: bug in .hi-boot file, or inconsistent .hi file", + text "Use -ddump-if-trace to get an idea of which file caused the error"]) {- @@ -325,7 +325,7 @@ loadWiredInHomeIface name = ASSERT( isWiredInName name ) do _ <- loadSysInterface doc (nameModule name); return () where - doc = ptext (sLit "Need home interface for wired-in thing") <+> ppr name + doc = text "Need home interface for wired-in thing" <+> ppr name ------------------ -- | Loads a system interface and throws an exception if it fails @@ -520,8 +520,8 @@ wantHiBootFile dflags eps mod from badSourceImport :: Module -> SDoc badSourceImport mod - = hang (ptext (sLit "You cannot {-# SOURCE #-} import a module from another package")) - 2 (ptext (sLit "but") <+> quotes (ppr mod) <+> ptext (sLit "is from package") + = hang (text "You cannot {-# SOURCE #-} import a module from another package") + 2 (text "but" <+> quotes (ppr mod) <+> ptext (sLit "is from package") <+> quotes (ppr (moduleUnitId mod))) ----------------------------------------------------- @@ -637,7 +637,7 @@ loadDecl ignore_prags (_version, decl) [(n, lookup n) | n <- implicit_names] } where - doc = ptext (sLit "Declaration for") <+> ppr (ifName decl) + doc = text "Declaration for" <+> ppr (ifName decl) bumpDeclStats :: Name -> IfL () -- Record that one more declaration has actually been used bumpDeclStats name @@ -684,13 +684,13 @@ findAndReadIface :: SDoc -> Module -- sometimes it's ok to fail... see notes with loadInterface findAndReadIface doc_str mod hi_boot_file - = do traceIf (sep [hsep [ptext (sLit "Reading"), + = do traceIf (sep [hsep [text "Reading", if hi_boot_file - then ptext (sLit "[boot]") + then text "[boot]" else Outputable.empty, - ptext (sLit "interface for"), + text "interface for", ppr mod <> semi], - nest 4 (ptext (sLit "reason:") <+> doc_str)]) + nest 4 (text "reason:" <+> doc_str)]) -- Check for GHC.Prim, and return its static interface if mod == gHC_PRIM @@ -718,12 +718,12 @@ findAndReadIface doc_str mod hi_boot_file checkBuildDynamicToo r return r err -> do - traceIf (ptext (sLit "...not found")) + traceIf (text "...not found") dflags <- getDynFlags return (Failed (cannotFindInterface dflags (moduleName mod) err)) where read_file file_path = do - traceIf (ptext (sLit "readIFace") <+> text file_path) + traceIf (text "readIFace" <+> text file_path) read_result <- readIface mod file_path case read_result of Failed err -> return (Failed (badIfaceFile file_path err)) @@ -866,11 +866,11 @@ showIface hsc_env filename = do pprModIface :: ModIface -> SDoc -- Show a ModIface pprModIface iface - = vcat [ ptext (sLit "interface") + = vcat [ text "interface" <+> ppr (mi_module iface) <+> pp_hsc_src (mi_hsc_src iface) - <+> (if mi_orphan iface then ptext (sLit "[orphan module]") else Outputable.empty) - <+> (if mi_finsts iface then ptext (sLit "[family instance module]") else Outputable.empty) - <+> (if mi_hpc iface then ptext (sLit "[hpc]") else Outputable.empty) + <+> (if mi_orphan iface then text "[orphan module]" else Outputable.empty) + <+> (if mi_finsts iface then text "[family instance module]" else Outputable.empty) + <+> (if mi_hpc iface then text "[hpc]" else Outputable.empty) <+> integer hiVersion , nest 2 (text "interface hash:" <+> ppr (mi_iface_hash iface)) , nest 2 (text "ABI hash:" <+> ppr (mi_mod_hash iface)) @@ -879,8 +879,8 @@ pprModIface iface , nest 2 (text "flag hash:" <+> ppr (mi_flag_hash iface)) , nest 2 (text "sig of:" <+> ppr (mi_sig_of iface)) , nest 2 (text "used TH splices:" <+> ppr (mi_used_th iface)) - , nest 2 (ptext (sLit "where")) - , ptext (sLit "exports:") + , nest 2 (text "where") + , text "exports:" , nest 2 (vcat (map pprExport (mi_exports iface))) , pprDeps (mi_deps iface) , vcat (map pprUsage (mi_usages iface)) @@ -896,8 +896,8 @@ pprModIface iface , pprTrustPkg (mi_trust_pkg iface) ] where - pp_hsc_src HsBootFile = ptext (sLit "[boot]") - pp_hsc_src HsigFile = ptext (sLit "[hsig]") + pp_hsc_src HsBootFile = text "[boot]" + pp_hsc_src HsigFile = text "[hsig]" pp_hsc_src HsSrcFile = Outputable.empty {- @@ -928,24 +928,24 @@ pprUsage usage@UsageHomeModule{} vcat [ ppr n <+> ppr v | (n,v) <- usg_entities usage ] ) pprUsage usage@UsageFile{} - = hsep [ptext (sLit "addDependentFile"), + = hsep [text "addDependentFile", doubleQuotes (text (usg_file_path usage))] pprUsageImport :: Outputable a => Usage -> (Usage -> a) -> SDoc pprUsageImport usage usg_mod' - = hsep [ptext (sLit "import"), safe, ppr (usg_mod' usage), + = hsep [text "import", safe, ppr (usg_mod' usage), ppr (usg_mod_hash usage)] where - safe | usg_safe usage = ptext $ sLit "safe" - | otherwise = ptext $ sLit " -/ " + safe | usg_safe usage = text "safe" + | otherwise = text " -/ " pprDeps :: Dependencies -> SDoc pprDeps (Deps { dep_mods = mods, dep_pkgs = pkgs, dep_orphs = orphs, dep_finsts = finsts }) - = vcat [ptext (sLit "module dependencies:") <+> fsep (map ppr_mod mods), - ptext (sLit "package dependencies:") <+> fsep (map ppr_pkg pkgs), - ptext (sLit "orphans:") <+> fsep (map ppr orphs), - ptext (sLit "family instance modules:") <+> fsep (map ppr finsts) + = vcat [text "module dependencies:" <+> fsep (map ppr_mod mods), + text "package dependencies:" <+> fsep (map ppr_pkg pkgs), + text "orphans:" <+> fsep (map ppr orphs), + text "family instance modules:" <+> fsep (map ppr finsts) ] where ppr_mod (mod_name, boot) = ppr mod_name <+> ppr_boot boot @@ -956,7 +956,7 @@ pprDeps (Deps { dep_mods = mods, dep_pkgs = pkgs, dep_orphs = orphs, pprFixities :: [(OccName, Fixity)] -> SDoc pprFixities [] = Outputable.empty -pprFixities fixes = ptext (sLit "fixities") <+> pprWithCommas pprFix fixes +pprFixities fixes = text "fixities" <+> pprWithCommas pprFix fixes where pprFix (occ,fix) = ppr fix <+> ppr occ @@ -968,32 +968,32 @@ pprVectInfo (IfaceVectInfo { ifaceVectInfoVar = vars , ifaceVectInfoParallelTyCons = parallelTyCons }) = vcat - [ ptext (sLit "vectorised variables:") <+> hsep (map ppr vars) - , ptext (sLit "vectorised tycons:") <+> hsep (map ppr tycons) - , ptext (sLit "vectorised reused tycons:") <+> hsep (map ppr tyconsReuse) - , ptext (sLit "parallel variables:") <+> hsep (map ppr parallelVars) - , ptext (sLit "parallel tycons:") <+> hsep (map ppr parallelTyCons) + [ text "vectorised variables:" <+> hsep (map ppr vars) + , text "vectorised tycons:" <+> hsep (map ppr tycons) + , text "vectorised reused tycons:" <+> hsep (map ppr tyconsReuse) + , text "parallel variables:" <+> hsep (map ppr parallelVars) + , text "parallel tycons:" <+> hsep (map ppr parallelTyCons) ] pprTrustInfo :: IfaceTrustInfo -> SDoc -pprTrustInfo trust = ptext (sLit "trusted:") <+> ppr trust +pprTrustInfo trust = text "trusted:" <+> ppr trust pprTrustPkg :: Bool -> SDoc -pprTrustPkg tpkg = ptext (sLit "require own pkg trusted:") <+> ppr tpkg +pprTrustPkg tpkg = text "require own pkg trusted:" <+> ppr tpkg instance Outputable Warnings where ppr = pprWarns pprWarns :: Warnings -> SDoc pprWarns NoWarnings = Outputable.empty -pprWarns (WarnAll txt) = ptext (sLit "Warn all") <+> ppr txt -pprWarns (WarnSome prs) = ptext (sLit "Warnings") +pprWarns (WarnAll txt) = text "Warn all" <+> ppr txt +pprWarns (WarnSome prs) = text "Warnings" <+> vcat (map pprWarning prs) where pprWarning (name, txt) = ppr name <+> ppr txt pprIfaceAnnotation :: IfaceAnnotation -> SDoc pprIfaceAnnotation (IfaceAnnotation { ifAnnotatedTarget = target, ifAnnotatedValue = serialized }) - = ppr target <+> ptext (sLit "annotated by") <+> ppr serialized + = ppr target <+> text "annotated by" <+> ppr serialized {- ********************************************************* @@ -1005,7 +1005,7 @@ pprIfaceAnnotation (IfaceAnnotation { ifAnnotatedTarget = target, ifAnnotatedVal badIfaceFile :: String -> SDoc -> SDoc badIfaceFile file err - = vcat [ptext (sLit "Bad interface file:") <+> text file, + = vcat [text "Bad interface file:" <+> text file, nest 4 err] hiModuleNameMismatchWarn :: Module -> Module -> MsgDoc @@ -1015,20 +1015,20 @@ hiModuleNameMismatchWarn requested_mod read_mod = withPprStyle (mkUserStyle alwaysQualify AllTheWay) $ -- we want the Modules below to be qualified with package names, -- so reset the PrintUnqualified setting. - hsep [ ptext (sLit "Something is amiss; requested module ") + hsep [ text "Something is amiss; requested module " , ppr requested_mod - , ptext (sLit "differs from name found in the interface file") + , text "differs from name found in the interface file" , ppr read_mod ] wrongIfaceModErr :: ModIface -> Module -> String -> SDoc wrongIfaceModErr iface mod_name file_path - = sep [ptext (sLit "Interface file") <+> iface_file, - ptext (sLit "contains module") <+> quotes (ppr (mi_module iface)) <> comma, - ptext (sLit "but we were expecting module") <+> quotes (ppr mod_name), - sep [ptext (sLit "Probable cause: the source code which generated"), + = sep [text "Interface file" <+> iface_file, + text "contains module" <+> quotes (ppr (mi_module iface)) <> comma, + text "but we were expecting module" <+> quotes (ppr mod_name), + sep [text "Probable cause: the source code which generated", nest 2 iface_file, - ptext (sLit "has an incompatible module name") + text "has an incompatible module name" ] ] where iface_file = doubleQuotes (text file_path) @@ -1036,8 +1036,8 @@ wrongIfaceModErr iface mod_name file_path homeModError :: Module -> ModLocation -> SDoc -- See Note [Home module load error] homeModError mod location - = ptext (sLit "attempting to use module ") <> quotes (ppr mod) + = text "attempting to use module " <> quotes (ppr mod) <> (case ml_hs_file location of Just file -> space <> parens (text file) Nothing -> Outputable.empty) - <+> ptext (sLit "which is not loaded") + <+> text "which is not loaded" diff --git a/compiler/iface/MkIface.hs b/compiler/iface/MkIface.hs index 9e4c30355c..1db02bd314 100644 --- a/compiler/iface/MkIface.hs +++ b/compiler/iface/MkIface.hs @@ -735,7 +735,7 @@ instance Outputable IfaceDeclExtras where ppr_id_extras_s stuff] ppr_insts :: [IfaceInstABI] -> SDoc -ppr_insts _ = ptext (sLit "<insts>") +ppr_insts _ = text "<insts>" ppr_id_extras_s :: [IfaceIdExtras] -> SDoc ppr_id_extras_s stuff = vcat (map ppr_id_extras stuff) @@ -1068,9 +1068,9 @@ checkFlagHash hsc_env iface = do (mi_module iface) putNameLiterally case old_hash == new_hash of - True -> up_to_date (ptext $ sLit "Module flags unchanged") + True -> up_to_date (text "Module flags unchanged") False -> out_of_date_hash "flags changed" - (ptext $ sLit " Module flags have changed") + (text " Module flags have changed") old_hash new_hash -- If the direct imports of this module are resolved to targets that @@ -1121,7 +1121,7 @@ needInterface :: Module -> (ModIface -> IfG RecompileRequired) -> IfG RecompileRequired needInterface mod continue = do -- Load the imported interface if possible - let doc_str = sep [ptext (sLit "need version info for"), ppr mod] + let doc_str = sep [text "need version info for", ppr mod] traceHiDiffs (text "Checking usages for module" <+> ppr mod) mb_iface <- loadInterface doc_str mod ImportBySystem @@ -1130,7 +1130,7 @@ needInterface mod continue case mb_iface of Failed _ -> do - traceHiDiffs (sep [ptext (sLit "Couldn't load interface for module"), + traceHiDiffs (sep [text "Couldn't load interface for module", ppr mod]) return MustCompile -- Couldn't find or parse a module mentioned in the @@ -1179,14 +1179,14 @@ checkModUsage this_pkg UsageHomeModule{ -- CHECK EXPORT LIST checkMaybeHash reason maybe_old_export_hash new_export_hash - (ptext (sLit " Export list changed")) $ do + (text " Export list changed") $ do -- CHECK ITEMS ONE BY ONE recompile <- checkList [ checkEntityUsage reason new_decl_hash u | u <- old_decl_hash] if recompileRequired recompile then return recompile -- This one failed, so just bail out now - else up_to_date (ptext (sLit " Great! The bits I use are up to date")) + else up_to_date (text " Great! The bits I use are up to date") checkModUsage _this_pkg UsageFile{ usg_file_path = file, @@ -1211,10 +1211,10 @@ checkModuleFingerprint :: String -> Fingerprint -> Fingerprint -> IfG RecompileRequired checkModuleFingerprint reason old_mod_hash new_mod_hash | new_mod_hash == old_mod_hash - = up_to_date (ptext (sLit "Module fingerprint unchanged")) + = up_to_date (text "Module fingerprint unchanged") | otherwise - = out_of_date_hash reason (ptext (sLit " Module fingerprint has changed")) + = out_of_date_hash reason (text " Module fingerprint has changed") old_mod_hash new_mod_hash ------------------------ @@ -1235,12 +1235,12 @@ checkEntityUsage reason new_hash (name,old_hash) = case new_hash name of Nothing -> -- We used it before, but it ain't there now - out_of_date reason (sep [ptext (sLit "No longer exported:"), ppr name]) + out_of_date reason (sep [text "No longer exported:", ppr name]) Just (_, new_hash) -- It's there, but is it up to date? | new_hash == old_hash -> do traceHiDiffs (text " Up to date" <+> ppr name <+> parens (ppr new_hash)) return UpToDate - | otherwise -> out_of_date_hash reason (ptext (sLit " Out of date:") <+> ppr name) + | otherwise -> out_of_date_hash reason (text " Out of date:" <+> ppr name) old_hash new_hash up_to_date :: SDoc -> IfG RecompileRequired @@ -1251,7 +1251,7 @@ out_of_date reason msg = traceHiDiffs msg >> return (RecompBecause reason) out_of_date_hash :: String -> SDoc -> Fingerprint -> Fingerprint -> IfG RecompileRequired out_of_date_hash reason msg old_hash new_hash - = out_of_date reason (hsep [msg, ppr old_hash, ptext (sLit "->"), ppr new_hash]) + = out_of_date reason (hsep [msg, ppr old_hash, text "->", ppr new_hash]) ---------------------- checkList :: [IfG RecompileRequired] -> IfG RecompileRequired diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs index b579b656e6..9d1886d27c 100644 --- a/compiler/iface/TcIface.hs +++ b/compiler/iface/TcIface.hs @@ -224,13 +224,13 @@ tcHiBootIface hsc_src mod -- The hi-boot file has mysteriously disappeared. }}}} where - need = ptext (sLit "Need the hi-boot interface for") <+> ppr mod - <+> ptext (sLit "to compare against the Real Thing") + need = text "Need the hi-boot interface for" <+> ppr mod + <+> text "to compare against the Real Thing" - moduleLoop = ptext (sLit "Circular imports: module") <+> quotes (ppr mod) - <+> ptext (sLit "depends on itself") + moduleLoop = text "Circular imports: module" <+> quotes (ppr mod) + <+> text "depends on itself" - elaborate err = hang (ptext (sLit "Could not find hi-boot interface for") <+> + elaborate err = hang (text "Could not find hi-boot interface for" <+> quotes (ppr mod) <> colon) 4 err @@ -353,7 +353,7 @@ tc_iface_decl _ _ (IfaceSynonym {ifName = occ_name, ifTyVars = tv_bndrs, ; let tycon = mkSynonymTyCon tc_name kind tyvars roles rhs ; return (ATyCon tycon) } where - mk_doc n = ptext (sLit "Type synonym") <+> ppr n + mk_doc n = text "Type synonym" <+> ppr n tc_iface_decl parent _ (IfaceFamily {ifName = occ_name, ifTyVars = tv_bndrs, ifFamFlav = fam_flav, @@ -368,7 +368,7 @@ tc_iface_decl parent _ (IfaceFamily {ifName = occ_name, ifTyVars = tv_bndrs, ; let tycon = mkFamilyTyCon tc_name kind tyvars res_name rhs parent inj ; return (ATyCon tycon) } where - mk_doc n = ptext (sLit "Type synonym") <+> ppr n + mk_doc n = text "Type synonym" <+> ppr n tc_fam_flav :: Name -> IfaceFamTyConFlav -> IfL FamTyConFlav tc_fam_flav tc_name IfaceDataFamilyTyCon @@ -448,9 +448,9 @@ tc_iface_decl _parent ignore_prags -- e.g. type AT a; type AT b = AT [b] Trac #8002 return (ATI tc mb_def) - mk_sc_doc pred = ptext (sLit "Superclass") <+> ppr pred - mk_at_doc tc = ptext (sLit "Associated type") <+> ppr tc - mk_op_doc op_name op_ty = ptext (sLit "Class op") <+> sep [ppr op_name, ppr op_ty] + mk_sc_doc pred = text "Superclass" <+> ppr pred + mk_at_doc tc = text "Associated type" <+> ppr tc + mk_op_doc op_name op_ty = text "Class op" <+> sep [ppr op_name, ppr op_ty] tc_fd (tvs1, tvs2) = do { tvs1' <- mapM tcIfaceTyVar tvs1 ; tvs2' <- mapM tcIfaceTyVar tvs2 @@ -481,7 +481,7 @@ tc_iface_decl _ _ (IfacePatSyn{ ifName = occ_name , ifPatTy = pat_ty , ifFieldLabels = field_labels }) = do { name <- lookupIfaceTop occ_name - ; traceIf (ptext (sLit "tc_iface_decl") <+> ppr name) + ; traceIf (text "tc_iface_decl" <+> ppr name) ; matcher <- tc_pr if_matcher ; builder <- fmapMaybeM tc_pr if_builder ; bindIfaceTvBndrs univ_tvs $ \univ_tvs -> do @@ -496,7 +496,7 @@ tc_iface_decl _ _ (IfacePatSyn{ ifName = occ_name arg_tys pat_ty field_labels } ; return $ AConLike . PatSynCon $ patsyn }}} where - mk_doc n = ptext (sLit "Pattern synonym") <+> ppr n + mk_doc n = text "Pattern synonym" <+> ppr n tc_pr :: (IfExtName, Bool) -> IfL (Id, Bool) tc_pr (nm, b) = do { id <- forkM (ppr nm) (tcIfaceExtId nm) ; return (id, b) } @@ -589,7 +589,7 @@ tcIfaceDataCons tycon_name tycon tc_tyvars if_cons arg_tys orig_res_ty tycon ; traceIf (text "Done interface-file tc_con_decl" <+> ppr dc_name) ; return con } - mk_doc con_name = ptext (sLit "Constructor") <+> ppr con_name + mk_doc con_name = text "Constructor" <+> ppr con_name tc_strict :: IfaceBang -> IfL HsImplBang tc_strict IfNoBang = return (HsLazy) @@ -639,7 +639,7 @@ tcIfaceInst :: IfaceClsInst -> IfL ClsInst tcIfaceInst (IfaceClsInst { ifDFun = dfun_occ, ifOFlag = oflag , ifInstCls = cls, ifInstTys = mb_tcs , ifInstOrph = orph }) - = do { dfun <- forkM (ptext (sLit "Dict fun") <+> ppr dfun_occ) $ + = do { dfun <- forkM (text "Dict fun" <+> ppr dfun_occ) $ tcIfaceExtId dfun_occ ; let mb_tcs' = map (fmap ifaceTyConName) mb_tcs ; return (mkImportedInstance cls mb_tcs' dfun oflag orph) } @@ -647,7 +647,7 @@ tcIfaceInst (IfaceClsInst { ifDFun = dfun_occ, ifOFlag = oflag tcIfaceFamInst :: IfaceFamInst -> IfL FamInst tcIfaceFamInst (IfaceFamInst { ifFamInstFam = fam, ifFamInstTys = mb_tcs , ifFamInstAxiom = axiom_name } ) - = do { axiom' <- forkM (ptext (sLit "Axiom") <+> ppr axiom_name) $ + = do { axiom' <- forkM (text "Axiom" <+> ppr axiom_name) $ tcIfaceCoAxiom axiom_name -- will panic if branched, but that's OK ; let axiom'' = toUnbranchedAxiom axiom' @@ -679,7 +679,7 @@ tcIfaceRule (IfaceRule {ifRuleName = name, ifActivation = act, ifRuleBndrs = bnd ifRuleAuto = auto, ifRuleOrph = orph }) = do { ~(bndrs', args', rhs') <- -- Typecheck the payload lazily, in the hope it'll never be looked at - forkM (ptext (sLit "Rule") <+> pprRuleName name) $ + forkM (text "Rule" <+> pprRuleName name) $ bindIfaceBndrs bndrs $ \ bndrs' -> do { args' <- mapM tcIfaceExpr args ; rhs' <- tcIfaceExpr rhs @@ -778,11 +778,11 @@ tcIfaceVectInfo mod typeEnv (IfaceVectInfo where vectVarMapping name = do { vName <- lookupIfaceTop (mkLocalisedOccName mod mkVectOcc name) - ; var <- forkM (ptext (sLit "vect var") <+> ppr name) $ + ; var <- forkM (text "vect var" <+> ppr name) $ tcIfaceExtId name - ; vVar <- forkM (ptext (sLit "vect vVar [mod =") <+> - ppr mod <> ptext (sLit "; nameModule =") <+> - ppr (nameModule name) <> ptext (sLit "]") <+> ppr vName) $ + ; vVar <- forkM (text "vect vVar [mod =" <+> + ppr mod <> text "; nameModule =" <+> + ppr (nameModule name) <> text "]" <+> ppr vName) $ tcIfaceExtId vName ; return (var, (var, vVar)) } @@ -801,7 +801,7 @@ tcIfaceVectInfo mod typeEnv (IfaceVectInfo -- notAnIdErr = pprPanic "TcIface.tcIfaceVectInfo: not an id" (ppr name) vectVar name - = forkM (ptext (sLit "vect scalar var") <+> ppr name) $ + = forkM (text "vect scalar var" <+> ppr name) $ tcIfaceExtId name vectTyConVectMapping vars name @@ -814,7 +814,7 @@ tcIfaceVectInfo mod typeEnv (IfaceVectInfo vectTyConMapping vars name vName = do { tycon <- lookupLocalOrExternalTyCon name - ; vTycon <- forkM (ptext (sLit "vTycon of") <+> ppr vName) $ + ; vTycon <- forkM (text "vTycon of" <+> ppr vName) $ lookupLocalOrExternalTyCon vName -- Map the data constructors of the original type constructor to those of the @@ -1261,10 +1261,10 @@ tcPragExpr name expr Nothing -> return () Just fail_msg -> do { mod <- getIfModule ; pprPanic "Iface Lint failure" - (vcat [ ptext (sLit "In interface for") <+> ppr mod + (vcat [ text "In interface for" <+> ppr mod , hang doc 2 fail_msg , ppr name <+> equals <+> ppr core_expr' - , ptext (sLit "Iface expr =") <+> ppr expr ]) } + , text "Iface expr =" <+> ppr expr ]) } return core_expr' where doc = text "Unfolding of" <+> ppr name |