@@ -1820,20 +1820,35 @@ pprintPTerm ppo bnd docArgs infixes = prettySe (ppopt_depth ppo) startPrec bnd
1820 TypeOrTerm -> id
1820 TypeOrTerm -> id
1821 IsType -> annName pairTy
1821 IsType -> annName pairTy
1822 IsTerm -> annName pairCon
1822 IsTerm -> annName pairCon
1823− prettySe d p bnd (PDPair _ _ pun l t r) =
1823+ prettySe d p bnd dpair@(PDPair _ _ pun l t r)
1824− depth d $
1824+ | Just elts <- dPairElts dpair
1825+ = depth d . enclose (annotated lparen) (annotated rparen) .
1826+ align . group . vsep . punctuate (space <> annotated (text "**")) $
1825− annotated lparen <>
1830+ annotated lparen <>
1826− left <+>
1831+ left <+>
1827− annotated (text "**") <+>
1832+ annotated (text "**") <+>
1828− prettySe (decD d) startPrec (addBinding bnd) r <>
1833+ prettySe (decD d) startPrec (addBinding bnd) r <>
1829− annotated rparen
1834+ annotated rparen
1830 where annotated = case pun of
1835 where annotated = case pun of
1831 IsType -> annName sigmaTy
1836 IsType -> annName sigmaTy
1832 IsTerm -> annName sigmaCon
1837 IsTerm -> annName sigmaCon
1833 TypeOrTerm -> id
1838 TypeOrTerm -> id
1834 (left, addBinding) = case (l, pun) of
1840 (left, addBinding) = case (l, pun) of
1835 (PRef _ _ n, IsType) -> (bindingOf n False <+> text ":" <+> prettySe (decD d) startPrec bnd t, ((n, False) :))
1841 (PRef _ _ n, IsType) -> (bindingOf n False <+> text ":" <+> prettySe (decD d) startPrec bnd t, ((n, False) :))
1836 _ -> (prettySe (decD d) startPrec bnd l, id)
1842 _ -> (prettySe (decD d) startPrec bnd l, id)
1845+ ppElts [(_, v)] bs = [prettySe (decD d) startPrec bs v]
1846+ ppElts ((PRef _ _ n, t):rs) bs
1848+ = (bindingOf n False <+> colon <+>
1849+ prettySe (decD d) startPrec bs t) : ppElts rs ((n, False):bs)
1850+ ppElts ((l, t):rs) bs
1851+ = (prettySe (decD d) startPrec bs l) : ppElts rs bs
1837 prettySe d p bnd (PAlternative ns a as) =
1852 prettySe d p bnd (PAlternative ns a as) =
1838 lparen <> text "|" <> prettyAs <> text "|" <> rparen
1853 lparen <> text "|" <> prettyAs <> text "|" <> rparen
@@ -1951,6 +1966,11 @@ pprintPTerm ppo bnd docArgs infixes = prettySe (ppopt_depth ppo) startPrec bnd
1951 | otherwise = Just [x, y]
1966 | otherwise = Just [x, y]
1952 pairElts _ = Nothing
1967 pairElts _ = Nothing
1969+ dPairElts :: PTerm -> Maybe [(PTerm, PTerm)]
1970+ dPairElts (PDPair _ _ _ l t r) | Just elts <- dPairElts r = Just ((l, t):elts)
1971+ | otherwise = Just [(l, t), (Placeholder, r)]
1972+ dPairElts _ = Nothing
1954 natns = "Prelude.Nat."
1974 natns = "Prelude.Nat."
1956 snat :: PPOption -> Maybe Int -> Int -> PTerm -> Maybe Integer
1976 snat :: PPOption -> Maybe Int -> Int -> PTerm -> Maybe Integer