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/cmm/SMRep.hs | |
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/cmm/SMRep.hs')
-rw-r--r-- | compiler/cmm/SMRep.hs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/compiler/cmm/SMRep.hs b/compiler/cmm/SMRep.hs index 6c0076122e..ecd8905cbb 100644 --- a/compiler/cmm/SMRep.hs +++ b/compiler/cmm/SMRep.hs @@ -498,44 +498,44 @@ instance Outputable SMRep where ppr (HeapRep static ps nps tyinfo) = hang (header <+> lbrace) 2 (ppr tyinfo <+> rbrace) where - header = ptext (sLit "HeapRep") - <+> if static then ptext (sLit "static") else empty + header = text "HeapRep" + <+> if static then text "static" else empty <+> pp_n "ptrs" ps <+> pp_n "nonptrs" nps pp_n :: String -> Int -> SDoc pp_n _ 0 = empty pp_n s n = int n <+> text s - ppr (ArrayPtrsRep size _) = ptext (sLit "ArrayPtrsRep") <+> ppr size + ppr (ArrayPtrsRep size _) = text "ArrayPtrsRep" <+> ppr size - ppr (SmallArrayPtrsRep size) = ptext (sLit "SmallArrayPtrsRep") <+> ppr size + ppr (SmallArrayPtrsRep size) = text "SmallArrayPtrsRep" <+> ppr size - ppr (ArrayWordsRep words) = ptext (sLit "ArrayWordsRep") <+> ppr words + ppr (ArrayWordsRep words) = text "ArrayWordsRep" <+> ppr words - ppr (StackRep bs) = ptext (sLit "StackRep") <+> ppr bs + ppr (StackRep bs) = text "StackRep" <+> ppr bs - ppr (RTSRep ty rep) = ptext (sLit "tag:") <> ppr ty <+> ppr rep + ppr (RTSRep ty rep) = text "tag:" <> ppr ty <+> ppr rep instance Outputable ArgDescr where - ppr (ArgSpec n) = ptext (sLit "ArgSpec") <+> ppr n - ppr (ArgGen ls) = ptext (sLit "ArgGen") <+> ppr ls + ppr (ArgSpec n) = text "ArgSpec" <+> ppr n + ppr (ArgGen ls) = text "ArgGen" <+> ppr ls pprTypeInfo :: ClosureTypeInfo -> SDoc pprTypeInfo (Constr tag descr) - = ptext (sLit "Con") <+> - braces (sep [ ptext (sLit "tag:") <+> ppr tag - , ptext (sLit "descr:") <> text (show descr) ]) + = text "Con" <+> + braces (sep [ text "tag:" <+> ppr tag + , text "descr:" <> text (show descr) ]) pprTypeInfo (Fun arity args) - = ptext (sLit "Fun") <+> - braces (sep [ ptext (sLit "arity:") <+> ppr arity + = text "Fun" <+> + braces (sep [ text "arity:" <+> ppr arity , ptext (sLit ("fun_type:")) <+> ppr args ]) pprTypeInfo (ThunkSelector offset) - = ptext (sLit "ThunkSel") <+> ppr offset + = text "ThunkSel" <+> ppr offset -pprTypeInfo Thunk = ptext (sLit "Thunk") -pprTypeInfo BlackHole = ptext (sLit "BlackHole") -pprTypeInfo IndStatic = ptext (sLit "IndStatic") +pprTypeInfo Thunk = text "Thunk" +pprTypeInfo BlackHole = text "BlackHole" +pprTypeInfo IndStatic = text "IndStatic" -- XXX Does not belong here!! stringToWord8s :: String -> [Word8] |