on master help sign in
Pretty-printing of implicit args to (=)

Now, the pretty-printer respects the "show implicts" option for propositional equality. Demo: ``` λΠ> (a : Type) -> (n,m,o : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (zs : Vect o a) -> xs ++ (ys ++ zs) = (xs ++ ys) ++ zs (a : Type) -> (n : Nat) -> (m : Nat) -> (o : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (zs : Vect o a) -> xs ++ ys ++ zs = (xs ++ ys) ++ zs : Type λΠ> :set showimplicits λΠ> (a : Type) -> (n,m,o : Nat) -> (xs : Vect n a) -> (ys : Vect m a) -> (zs : Vect o a) -> xs ++ (ys ++ zs) = (xs ++ ys) ++ zs (a : Type) -> (n : Prelude.Nat.Nat) -> (m : Prelude.Nat.Nat) -> (o : Prelude.Nat.Nat) -> (xs : Prelude.Vect.Vect n a) -> (ys : Prelude.Vect.Vect m a) -> (zs : Prelude.Vect.Vect o a) -> (=) {A = Prelude.Vect.Vect (Prelude.Nat.plus n (Prelude.Nat.plus m o)) a} {B = Prelude.Vect.Vect (Prelude.Nat.plus (Prelude.Nat.plus n m) o) a} (Prelude.Vect.(++) {m = n} {a = a} {n = Prelude.Nat.plus m o} xs (Prelude.Vect.(++) {m = m} {a = a} {n = o} ys zs)) (Prelude.Vect.(++) {m = Prelude.Nat.plus n m} {a = a} {n = o} (Prelude.Vect.(++) {m = n} {a = a} {n = m} xs ys) zs) : Type ``` This fixes #1410.

commitba0b52520dd582325cb28f4960659a71e659ae50 authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateWed 24 Sep 2014, 09:24 (12 years ago) parent497caf0
1 file changed+12−3
src/Idris/AbsSyntaxTree.hs+12−3
src/Idris/AbsSyntaxTree.hs+12−3
@@ -1342,9 +1342,18 @@ pprintPTerm ppo bnd docArgs infixes = prettySe 10 bnd
13421342 prettySe p bnd (PTrue _ IsTerm) = annName unitCon $ text "()"
13431343 prettySe p bnd (PTrue _ TypeOrTerm) = text "()"
13441344 prettySe p bnd (PFalse _) = annName falseTy $ text "_|_"
1345− prettySe p bnd (PEq _ _ _ l r) =
1346− bracket p 2 . align . group $
1347− prettySe 10 bnd l <+> eq <$> group (prettySe 10 bnd r)
1345+ prettySe p bnd (PEq _ lt rt l r)
1346+ | ppopt_impl ppo =
1347+ bracket p 1 $
1348+ enclose lparen rparen eq <+>
1349+ align (group (vsep (map (prettyArgS bnd)
1350+ [PImp 0 False [] (sUN "A") lt,
1351+ PImp 0 False [] (sUN "B") rt,
1352+ PExp 0 [] (sUN "x") l,
1353+ PExp 0 [] (sUN "y") r])))
1354+ | otherwise =
1355+ bracket p 2 . align . group $
1356+ prettySe 10 bnd l <+> eq <$> group (prettySe 10 bnd r)
13481357 where eq = annName eqTy (text "=")
13491358 prettySe p bnd (PRewrite _ l r _) =
13501359 bracket p 2 $