summaryrefslogtreecommitdiff
path: root/compiler/types/TypeRep.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/types/TypeRep.hs')
-rw-r--r--compiler/types/TypeRep.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/compiler/types/TypeRep.hs b/compiler/types/TypeRep.hs
index c78c9c5975..ea7724cfdd 100644
--- a/compiler/types/TypeRep.hs
+++ b/compiler/types/TypeRep.hs
@@ -730,8 +730,7 @@ pprTcApp _ pp tc [ty]
pprTcApp p pp tc tys
| isTupleTyCon tc && tyConArity tc == length tys
- = pprPromotionQuote tc <>
- tupleParens (tupleTyConSort tc) (sep (punctuate comma (map (pp TopPrec) tys)))
+ = pprTupleApp p pp tc tys
| Just dc <- isPromotedDataCon_maybe tc
, let dc_tc = dataConTyCon dc
@@ -746,6 +745,17 @@ pprTcApp p pp tc tys
| otherwise
= sdocWithDynFlags (pprTcApp_help p pp tc tys)
+pprTupleApp :: TyPrec -> (TyPrec -> a -> SDoc) -> TyCon -> [a] -> SDoc
+-- Print a saturated tuple
+pprTupleApp p pp tc tys
+ | null tys
+ , ConstraintTuple <- tupleTyConSort tc
+ = maybeParen p TopPrec $
+ ppr tc <+> dcolon <+> ppr (tyConKind tc)
+ | otherwise
+ = pprPromotionQuote tc <>
+ tupleParens (tupleTyConSort tc) (sep (punctuate comma (map (pp TopPrec) tys)))
+
pprTcApp_help :: TyPrec -> (TyPrec -> a -> SDoc) -> TyCon -> [a] -> DynFlags -> SDoc
-- This one has accss to the DynFlags
pprTcApp_help p pp tc tys dflags