summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2020-01-06 15:26:21 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-01-08 06:17:47 -0500
commit923a127205dd60147453f4420614efd1be29f070 (patch)
tree08756ee0f8baef622d5ca3cb2f021a3c51cd43ef /compiler
parentd589410f6bf394c8aca53f18848bbe4dfca92f23 (diff)
downloadhaskell-923a127205dd60147453f4420614efd1be29f070.tar.gz
Print Core type applications with no whitespace after @ (#17643)
This brings the pretty-printer for Core in line with how visible type applications are normally printed: namely, with no whitespace after the `@` character (i.e., `f @a` instead of `f @ a`). While I'm in town, I also give the same treatment to type abstractions (i.e., `\(@a)` instead of `\(@ a)`) and coercion applications (i.e., `f @~x` instead of `f @~ x`). Fixes #17643.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Iface/Syntax.hs4
-rw-r--r--compiler/GHC/Iface/Type.hs4
-rw-r--r--compiler/basicTypes/RdrName.hs2
-rw-r--r--compiler/coreSyn/PprCore.hs8
-rw-r--r--compiler/specialise/Specialise.hs2
-rw-r--r--compiler/typecheck/TcEvidence.hs2
6 files changed, 11 insertions, 11 deletions
diff --git a/compiler/GHC/Iface/Syntax.hs b/compiler/GHC/Iface/Syntax.hs
index 723401cb7e..9509cfe77c 100644
--- a/compiler/GHC/Iface/Syntax.hs
+++ b/compiler/GHC/Iface/Syntax.hs
@@ -1290,8 +1290,8 @@ pprIfaceExpr _ (IfaceLcl v) = ppr v
pprIfaceExpr _ (IfaceExt v) = ppr v
pprIfaceExpr _ (IfaceLit l) = ppr l
pprIfaceExpr _ (IfaceFCall cc ty) = braces (ppr cc <+> ppr ty)
-pprIfaceExpr _ (IfaceType ty) = char '@' <+> pprParendIfaceType ty
-pprIfaceExpr _ (IfaceCo co) = text "@~" <+> pprParendIfaceCoercion co
+pprIfaceExpr _ (IfaceType ty) = char '@' <> pprParendIfaceType ty
+pprIfaceExpr _ (IfaceCo co) = text "@~" <> pprParendIfaceCoercion co
pprIfaceExpr add_par app@(IfaceApp _ _) = add_par (pprIfaceApp app [])
pprIfaceExpr _ (IfaceTuple c as) = tupleParens c (pprWithCommas ppr as)
diff --git a/compiler/GHC/Iface/Type.hs b/compiler/GHC/Iface/Type.hs
index fbabb5b8b5..184849d319 100644
--- a/compiler/GHC/Iface/Type.hs
+++ b/compiler/GHC/Iface/Type.hs
@@ -714,8 +714,8 @@ isIfaceTauType _ = True
instance Outputable IfaceBndr where
ppr (IfaceIdBndr bndr) = pprIfaceIdBndr bndr
- ppr (IfaceTvBndr bndr) = char '@' <+> pprIfaceTvBndr bndr (SuppressBndrSig False)
- (UseBndrParens False)
+ ppr (IfaceTvBndr bndr) = char '@' <> pprIfaceTvBndr bndr (SuppressBndrSig False)
+ (UseBndrParens False)
pprIfaceBndrs :: [IfaceBndr] -> SDoc
pprIfaceBndrs bs = sep (map ppr bs)
diff --git a/compiler/basicTypes/RdrName.hs b/compiler/basicTypes/RdrName.hs
index 87e6fd41b6..1cf2b6b260 100644
--- a/compiler/basicTypes/RdrName.hs
+++ b/compiler/basicTypes/RdrName.hs
@@ -280,7 +280,7 @@ instance Outputable RdrName where
instance OutputableBndr RdrName where
pprBndr _ n
- | isTvOcc (rdrNameOcc n) = char '@' <+> ppr n
+ | isTvOcc (rdrNameOcc n) = char '@' <> ppr n
| otherwise = ppr n
pprInfixOcc rdr = pprInfixVar (isSymOcc (rdrNameOcc rdr)) (ppr rdr)
diff --git a/compiler/coreSyn/PprCore.hs b/compiler/coreSyn/PprCore.hs
index c959fc1c4e..0bf188e6a8 100644
--- a/compiler/coreSyn/PprCore.hs
+++ b/compiler/coreSyn/PprCore.hs
@@ -319,8 +319,8 @@ pprArg (Type ty)
= sdocWithDynFlags $ \dflags ->
if gopt Opt_SuppressTypeApplications dflags
then empty
- else text "@" <+> pprParendType ty
-pprArg (Coercion co) = text "@~" <+> pprOptCo co
+ else text "@" <> pprParendType ty
+pprArg (Coercion co) = text "@~" <> pprOptCo co
pprArg expr = pprParendExpr expr
{-
@@ -381,7 +381,7 @@ pprCoreBinder bind_site bndr
pprUntypedBinder :: Var -> SDoc
pprUntypedBinder binder
- | isTyVar binder = text "@" <+> ppr binder -- NB: don't print kind
+ | isTyVar binder = text "@" <> ppr binder -- NB: don't print kind
| otherwise = pprIdBndr binder
pprTypedLamBinder :: BindingSite -> Bool -> Var -> SDoc
@@ -431,7 +431,7 @@ pprTypedLetBinder binder
pprKindedTyVarBndr :: TyVar -> SDoc
-- Print a type variable binder with its kind (but not if *)
pprKindedTyVarBndr tyvar
- = text "@" <+> pprTyVar tyvar
+ = text "@" <> pprTyVar tyvar
-- pprIdBndr does *not* print the type
-- When printing any Id binder in debug mode, we print its inline pragma and one-shot-ness
diff --git a/compiler/specialise/Specialise.hs b/compiler/specialise/Specialise.hs
index 642071129e..1dcf76b8ea 100644
--- a/compiler/specialise/Specialise.hs
+++ b/compiler/specialise/Specialise.hs
@@ -2158,7 +2158,7 @@ pprCallInfo fn (CI { ci_key = key })
= ppr fn <+> ppr key
ppr_call_key_ty :: SpecArg -> Maybe SDoc
-ppr_call_key_ty (SpecType ty) = Just $ char '@' <+> pprParendType ty
+ppr_call_key_ty (SpecType ty) = Just $ char '@' <> pprParendType ty
ppr_call_key_ty UnspecType = Just $ char '_'
ppr_call_key_ty (SpecDict _) = Nothing
ppr_call_key_ty UnspecArg = Nothing
diff --git a/compiler/typecheck/TcEvidence.hs b/compiler/typecheck/TcEvidence.hs
index ee5b72033f..77ea45b3d5 100644
--- a/compiler/typecheck/TcEvidence.hs
+++ b/compiler/typecheck/TcEvidence.hs
@@ -924,7 +924,7 @@ pprHsWrapper wrap pp_thing_inside
help it (WpCast co) = add_parens $ sep [it False, nest 2 (text "|>"
<+> pprParendCo co)]
help it (WpEvApp id) = no_parens $ sep [it True, nest 2 (ppr id)]
- help it (WpTyApp ty) = no_parens $ sep [it True, text "@" <+> pprParendType ty]
+ help it (WpTyApp ty) = no_parens $ sep [it True, text "@" <> pprParendType ty]
help it (WpEvLam id) = add_parens $ sep [ text "\\" <> pprLamBndr id <> dot, it False]
help it (WpTyLam tv) = add_parens $ sep [text "/\\" <> pprLamBndr tv <> dot, it False]
help it (WpLet binds) = add_parens $ sep [text "let" <+> braces (ppr binds), it False]