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/typecheck/FunDeps.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/typecheck/FunDeps.hs')
-rw-r--r-- | compiler/typecheck/FunDeps.hs | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/compiler/typecheck/FunDeps.hs b/compiler/typecheck/FunDeps.hs index b4edd37c3e..edf178182b 100644 --- a/compiler/typecheck/FunDeps.hs +++ b/compiler/typecheck/FunDeps.hs @@ -32,7 +32,6 @@ import Outputable import ErrUtils( Validity(..), allValid ) import SrcLoc import Util -import FastString import Pair ( Pair(..) ) import Data.List ( nubBy ) @@ -185,8 +184,8 @@ improveFromAnother _ _ _ = [] pprEquation :: FunDepEqn a -> SDoc pprEquation (FDEqn { fd_qtvs = qtvs, fd_eqs = pairs }) - = vcat [ptext (sLit "forall") <+> braces (pprWithCommas ppr qtvs), - nest 2 (vcat [ ppr t1 <+> ptext (sLit "~") <+> ppr t2 + = vcat [text "forall" <+> braces (pprWithCommas ppr qtvs), + nest 2 (vcat [ ppr t1 <+> text "~" <+> ppr t2 | Pair t1 t2 <- pairs])] improveFromInstEnv :: InstEnvs @@ -389,26 +388,26 @@ checkInstCoverage be_liberal clas theta inst_taus -- , text "theta" <+> ppr theta -- , text "oclose" <+> ppr (oclose theta (closeOverKinds ls_tvs)) -- , text "rs_tvs" <+> ppr rs_tvs - sep [ ptext (sLit "The") - <+> ppWhen be_liberal (ptext (sLit "liberal")) - <+> ptext (sLit "coverage condition fails in class") + sep [ text "The" + <+> ppWhen be_liberal (text "liberal") + <+> text "coverage condition fails in class" <+> quotes (ppr clas) - , nest 2 $ ptext (sLit "for functional dependency:") + , nest 2 $ text "for functional dependency:" <+> quotes (pprFunDep fd) ] - , sep [ ptext (sLit "Reason: lhs type")<>plural ls <+> pprQuotedList ls + , sep [ text "Reason: lhs type"<>plural ls <+> pprQuotedList ls , nest 2 $ (if isSingleton ls - then ptext (sLit "does not") - else ptext (sLit "do not jointly")) - <+> ptext (sLit "determine rhs type")<>plural rs + then text "does not" + else text "do not jointly") + <+> text "determine rhs type"<>plural rs <+> pprQuotedList rs ] - , ptext (sLit "Un-determined variable") <> plural undet_list <> colon + , text "Un-determined variable" <> plural undet_list <> colon <+> pprWithCommas ppr undet_list , ppWhen (isEmptyVarSet $ pSnd undetermined_tvs) $ - ptext (sLit "(Use -fprint-explicit-kinds to see the kind variables in the types)") + text "(Use -fprint-explicit-kinds to see the kind variables in the types)" , ppWhen (not be_liberal && and (isEmptyVarSet <$> liberal_undet_tvs)) $ - ptext (sLit "Using UndecidableInstances might help") ] + text "Using UndecidableInstances might help" ] {- Note [Closing over kinds in coverage] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |