@@ -1179,20 +1179,14 @@ pprintPTerm impl bnd = prettySe 10 bnd
11791179 text "rewrite" <+> prettySe 10 bnd l <+> text "in" <+> prettySe 10 bnd r
11801180 prettySe p bnd (PTyped l r) =
11811181 lparen <> prettySe 10 bnd l <+> colon <+> prettySe 10 bnd r <> rparen
1182− prettySe p bnd (PPair _ TypeOrTerm l r) =
1183− lparen <> prettySe 10 bnd l <> text "," <+> prettySe 10 bnd r <> rparen
1184− prettySe p bnd (PPair _ IsType l r) =
1185− annotate (AnnName pairTy Nothing Nothing) lparen <>
1186− prettySe 10 bnd l <>
1187− annotate (AnnName pairTy Nothing Nothing) comma <+>
1188− prettySe 10 bnd r <>
1189− annotate (AnnName pairTy Nothing Nothing) rparen
1190− prettySe p bnd (PPair _ IsTerm l r) =
1191− annotate (AnnName pairCon Nothing Nothing) lparen <>
1192− prettySe 10 bnd l <>
1193− annotate (AnnName pairCon Nothing Nothing) comma <+>
1194− prettySe 10 bnd r <>
1195− annotate (AnnName pairCon Nothing Nothing) rparen
1182+ prettySe p bnd pair@(PPair _ pun _ _) -- flatten tuples to the right, like parser
1183+ | Just elts <- pairElts pair = enclose (ann lparen) (ann rparen) .
1184+ align . group . vsep . punctuate (ann comma) $
1185+ map (prettySe 10 bnd) elts
1186+ where ann = case pun of
1187+ TypeOrTerm -> id
1188+ IsType -> annotate (AnnName pairTy Nothing Nothing)
1189+ IsTerm -> annotate (AnnName pairCon Nothing Nothing)
11961190 prettySe p bnd (PDPair _ TypeOrTerm l t r) =
11971191 lparen <> prettySe 10 bnd l <+> text "**" <+> prettySe 10 bnd r <> rparen
11981192 prettySe p bnd (PDPair _ IsType (PRef _ n) t r) =
@@ -1281,6 +1275,11 @@ pprintPTerm impl bnd = prettySe 10 bnd
12811275 comma = (annotate AnnConstData (text ","))
12821276 slist _ _ _ = Nothing
12831277
1278+ pairElts :: PTerm -> Maybe [PTerm]
1279+ pairElts (PPair _ _ x y) | Just elts <- pairElts y = Just (x:elts)
1280+ | otherwise = Just [x, y]
1281+ pairElts _ = Nothing
1282+
12841283 natns = "Prelude.Nat."
12851284
12861285 snat p (PRef _ z)