@@ -827,9 +827,7 @@ data PTerm = PQuote Raw -- ^ Inclusion of a core term into the high-level langua
827 | PIfThenElse FC PTerm PTerm PTerm -- ^ Conditional expressions - elaborated to an overloading of ifThenElse
827 | PIfThenElse FC PTerm PTerm PTerm -- ^ Conditional expressions - elaborated to an overloading of ifThenElse
828 | PCase FC PTerm [(PTerm, PTerm)] -- ^ A case expression. Args are source location, scrutinee, and a list of pattern/RHS pairs
828 | PCase FC PTerm [(PTerm, PTerm)] -- ^ A case expression. Args are source location, scrutinee, and a list of pattern/RHS pairs
829 | PTrue FC PunInfo -- ^ Unit type..?
829 | PTrue FC PunInfo -- ^ Unit type..?
830− | PRefl FC PTerm -- ^ The canonical proof of the equality type
831 | PResolveTC FC -- ^ Solve this dictionary by type class resolution
830 | PResolveTC FC -- ^ Solve this dictionary by type class resolution
832− | PEq FC PTerm PTerm PTerm PTerm -- ^ Heterogeneous equality type: A = B
833 | PRewrite FC PTerm PTerm (Maybe PTerm) -- ^ "rewrite" syntax, with optional result type
831 | PRewrite FC PTerm PTerm (Maybe PTerm) -- ^ "rewrite" syntax, with optional result type
834 | PPair FC PunInfo PTerm PTerm -- ^ A pair (a, b) and whether it's a product type or a pair (solved by elaboration)
832 | PPair FC PunInfo PTerm PTerm -- ^ A pair (a, b) and whether it's a product type or a pair (solved by elaboration)
835 | PDPair FC PunInfo PTerm PTerm PTerm -- ^ A dependent pair (tm : a ** b) and whether it's a sigma type or a pair that inhabits one (solved by elaboration)
833 | PDPair FC PunInfo PTerm PTerm PTerm -- ^ A dependent pair (tm : a ** b) and whether it's a sigma type or a pair that inhabits one (solved by elaboration)
@@ -876,7 +874,6 @@ mapPT f t = f (mpt t) where
876 mpt (PAppBind fc t as) = PAppBind fc (mapPT f t) (map (fmap (mapPT f)) as)
874 mpt (PAppBind fc t as) = PAppBind fc (mapPT f t) (map (fmap (mapPT f)) as)
877 mpt (PCase fc c os) = PCase fc (mapPT f c) (map (pmap (mapPT f)) os)
875 mpt (PCase fc c os) = PCase fc (mapPT f c) (map (pmap (mapPT f)) os)
878 mpt (PIfThenElse fc c t e) = PIfThenElse fc (mapPT f c) (mapPT f t) (mapPT f e)
876 mpt (PIfThenElse fc c t e) = PIfThenElse fc (mapPT f c) (mapPT f t) (mapPT f e)
879− mpt (PEq fc lt rt l r) = PEq fc (mapPT f lt) (mapPT f rt) (mapPT f l) (mapPT f r)
880 mpt (PTyped l r) = PTyped (mapPT f l) (mapPT f r)
877 mpt (PTyped l r) = PTyped (mapPT f l) (mapPT f r)
881 mpt (PPair fc p l r) = PPair fc p (mapPT f l) (mapPT f r)
878 mpt (PPair fc p l r) = PPair fc p (mapPT f l) (mapPT f r)
882 mpt (PDPair fc p l t r) = PDPair fc p (mapPT f l) (mapPT f t) (mapPT f r)
879 mpt (PDPair fc p l t r) = PDPair fc p (mapPT f l) (mapPT f t) (mapPT f r)
@@ -1036,9 +1033,7 @@ highestFC (PMatchApp fc _) = Just fc
1036highestFC (PCase fc _ _) = Just fc
1033highestFC (PCase fc _ _) = Just fc
1037highestFC (PIfThenElse fc _ _ _) = Just fc
1034highestFC (PIfThenElse fc _ _ _) = Just fc
1038highestFC (PTrue fc _) = Just fc
1035highestFC (PTrue fc _) = Just fc
1039−highestFC (PRefl fc _) = Just fc
1040highestFC (PResolveTC fc) = Just fc
1036highestFC (PResolveTC fc) = Just fc
1041−highestFC (PEq fc _ _ _ _) = Just fc
1042highestFC (PRewrite fc _ _ _) = Just fc
1037highestFC (PRewrite fc _ _ _) = Just fc
1043highestFC (PPair fc _ _ _) = Just fc
1038highestFC (PPair fc _ _ _) = Just fc
1044highestFC (PDPair fc _ _ _ _) = Just fc
1039highestFC (PDPair fc _ _ _ _) = Just fc
@@ -1490,6 +1485,21 @@ pprintPTerm ppo bnd docArgs infixes = prettySe startPrec bnd
1490 bracket p startPrec $
1485 bracket p startPrec $
1491 lbrace <> kwd "tacimp" <+> pretty n <+> colon <+> prettySe startPrec bnd ty <>
1486 lbrace <> kwd "tacimp" <+> pretty n <+> colon <+> prettySe startPrec bnd ty <>
1492 rbrace <+> text "->" </> prettySe startPrec ((n, True):bnd) sc
1487 rbrace <+> text "->" </> prettySe startPrec ((n, True):bnd) sc
1488+ -- This case preserves the behavior of the former constructor PEq.
1489+ -- It should be removed if feasible when the pretty-printing of infix
1490+ -- operators in general is improved.
1491+ prettySe p bnd (PApp _ (PRef _ n) [lt, rt, l, r])
1492+ | n == eqTy, ppopt_impl ppo =
1494+ enclose lparen rparen eq <+>
1495+ align (group (vsep (map (prettyArgS bnd)
1498+ bracket p eqPrec . align . group $
1499+ prettyTerm (getTm l) <+> eq <$> group (prettyTerm (getTm r))
1500+ where eq = annName eqTy (text "=")
1502+ prettyTerm = prettySe (eqPrec + 1) bnd
1493 prettySe p bnd (PApp _ (PRef _ f) args) -- normal names, no explicit args
1503 prettySe p bnd (PApp _ (PRef _ f) args) -- normal names, no explicit args
1494 | UN nm <- basename f
1504 | UN nm <- basename f
1495 , not (ppopt_impl ppo) && null (getShowArgs args) =
1505 , not (ppopt_impl ppo) && null (getShowArgs args) =
@@ -1565,26 +1575,10 @@ pprintPTerm ppo bnd docArgs infixes = prettySe startPrec bnd
1565 , kwd "else" <+> prettySe startPrec bnd f
1575 , kwd "else" <+> prettySe startPrec bnd f
1567 prettySe p bnd (PHidden tm) = text "." <> prettySe funcAppPrec bnd tm
1577 prettySe p bnd (PHidden tm) = text "." <> prettySe funcAppPrec bnd tm
1568− prettySe p bnd (PRefl _ _) = annName eqCon $ text "Refl"
1569 prettySe p bnd (PResolveTC _) = kwd "%instance"
1578 prettySe p bnd (PResolveTC _) = kwd "%instance"
1570 prettySe p bnd (PTrue _ IsType) = annName unitTy $ text "()"
1579 prettySe p bnd (PTrue _ IsType) = annName unitTy $ text "()"
1571 prettySe p bnd (PTrue _ IsTerm) = annName unitCon $ text "()"
1580 prettySe p bnd (PTrue _ IsTerm) = annName unitCon $ text "()"
1572 prettySe p bnd (PTrue _ TypeOrTerm) = text "()"
1581 prettySe p bnd (PTrue _ TypeOrTerm) = text "()"
1573− prettySe p bnd (PEq _ lt rt l r)
1576− enclose lparen rparen eq <+>
1577− align (group (vsep (map (prettyArgS bnd)
1578− [PImp 0 False [] (sUN "A") lt,
1579− PImp 0 False [] (sUN "B") rt,
1580− PExp 0 [] (sUN "x") l,
1581− PExp 0 [] (sUN "y") r])))
1583− bracket p eqPrec . align . group $
1584− prettyTerm l <+> eq <$> group (prettyTerm r)
1585− where eq = annName eqTy (text "=")
1587− prettyTerm = prettySe (eqPrec + 1) bnd
1588 prettySe p bnd (PRewrite _ l r _) =
1582 prettySe p bnd (PRewrite _ l r _) =
1589 bracket p startPrec $
1583 bracket p startPrec $
1590 text "rewrite" <+> prettySe (startPrec + 1) bnd l <+> text "in" <+> prettySe startPrec bnd r
1584 text "rewrite" <+> prettySe (startPrec + 1) bnd l <+> text "in" <+> prettySe startPrec bnd r
@@ -1881,9 +1875,7 @@ instance Sized PTerm where
1881 size (PCase fc trm bdy) = 1 + size trm + size bdy
1875 size (PCase fc trm bdy) = 1 + size trm + size bdy
1882 size (PIfThenElse fc c t f) = 1 + sum (map size [c, t, f])
1876 size (PIfThenElse fc c t f) = 1 + sum (map size [c, t, f])
1883 size (PTrue fc _) = 1
1877 size (PTrue fc _) = 1
1884− size (PRefl fc _) = 1
1885 size (PResolveTC fc) = 1
1878 size (PResolveTC fc) = 1
1886− size (PEq fc _ _ left right) = 1 + size left + size right
1887 size (PRewrite fc left right _) = 1 + size left + size right
1879 size (PRewrite fc left right _) = 1 + size left + size right
1888 size (PPair fc _ left right) = 1 + size left + size right
1880 size (PPair fc _ left right) = 1 + size left + size right
1889 size (PDPair fs _ left ty right) = 1 + size left + size ty + size right
1881 size (PDPair fs _ left ty right) = 1 + size left + size ty + size right
@@ -1924,7 +1916,6 @@ allNamesIn tm = nub $ ni [] tm
1924 ni env (PLam fc n _ ty sc) = ni env ty ++ ni (n:env) sc
1916 ni env (PLam fc n _ ty sc) = ni env ty ++ ni (n:env) sc
1925 ni env (PPi p n _ ty sc) = niTacImp env p ++ ni env ty ++ ni (n:env) sc
1917 ni env (PPi p n _ ty sc) = niTacImp env p ++ ni env ty ++ ni (n:env) sc
1926 ni env (PHidden tm) = ni env tm
1918 ni env (PHidden tm) = ni env tm
1927− ni env (PEq _ _ _ l r) = ni env l ++ ni env r
1928 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1919 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1929 ni env (PTyped l r) = ni env l ++ ni env r
1920 ni env (PTyped l r) = ni env l ++ ni env r
1930 ni env (PPair _ _ l r) = ni env l ++ ni env r
1921 ni env (PPair _ _ l r) = ni env l ++ ni env r
@@ -1951,7 +1942,6 @@ boundNamesIn tm = S.toList (ni S.empty tm)
1951 ni set (PLam fc n _ ty sc) = S.insert n $ ni (ni set ty) sc
1942 ni set (PLam fc n _ ty sc) = S.insert n $ ni (ni set ty) sc
1952 ni set (PLet fc n nfc ty val sc) = S.insert n $ ni (ni (ni set ty) val) sc
1943 ni set (PLet fc n nfc ty val sc) = S.insert n $ ni (ni (ni set ty) val) sc
1953 ni set (PPi p n _ ty sc) = niTacImp (S.insert n $ ni (ni set ty) sc) p
1944 ni set (PPi p n _ ty sc) = niTacImp (S.insert n $ ni (ni set ty) sc) p
1954− ni set (PEq _ _ _ l r) = ni (ni set l) r
1955 ni set (PRewrite _ l r _) = ni (ni set l) r
1945 ni set (PRewrite _ l r _) = ni (ni set l) r
1956 ni set (PTyped l r) = ni (ni set l) r
1946 ni set (PTyped l r) = ni (ni set l) r
1957 ni set (PPair _ _ l r) = ni (ni set l) r
1947 ni set (PPair _ _ l r) = ni (ni set l) r
@@ -1991,7 +1981,6 @@ implicitNamesIn uvars ist tm = nub $ ni [] tm
1991 ni env (PIfThenElse _ c t f) = concatMap (ni env) [c, t, f]
1981 ni env (PIfThenElse _ c t f) = concatMap (ni env) [c, t, f]
1992 ni env (PLam fc n _ ty sc) = ni env ty ++ ni (n:env) sc
1982 ni env (PLam fc n _ ty sc) = ni env ty ++ ni (n:env) sc
1993 ni env (PPi p n _ ty sc) = ni env ty ++ ni (n:env) sc
1983 ni env (PPi p n _ ty sc) = ni env ty ++ ni (n:env) sc
1994− ni env (PEq _ _ _ l r) = ni env l ++ ni env r
1995 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1984 ni env (PRewrite _ l r _) = ni env l ++ ni env r
1996 ni env (PTyped l r) = ni env l ++ ni env r
1985 ni env (PTyped l r) = ni env l ++ ni env r
1997 ni env (PPair _ _ l r) = ni env l ++ ni env r
1986 ni env (PPair _ _ l r) = ni env l ++ ni env r
@@ -2022,7 +2011,6 @@ namesIn uvars ist tm = nub $ ni [] tm
2022 ni env (PIfThenElse _ c t f) = concatMap (ni env) [c, t, f]
2011 ni env (PIfThenElse _ c t f) = concatMap (ni env) [c, t, f]
2023 ni env (PLam fc n nfc ty sc) = ni env ty ++ ni (n:env) sc
2012 ni env (PLam fc n nfc ty sc) = ni env ty ++ ni (n:env) sc
2024 ni env (PPi p n _ ty sc) = niTacImp env p ++ ni env ty ++ ni (n:env) sc
2013 ni env (PPi p n _ ty sc) = niTacImp env p ++ ni env ty ++ ni (n:env) sc
2025− ni env (PEq _ _ _ l r) = ni env l ++ ni env r
2026 ni env (PRewrite _ l r _) = ni env l ++ ni env r
2014 ni env (PRewrite _ l r _) = ni env l ++ ni env r
2027 ni env (PTyped l r) = ni env l ++ ni env r
2015 ni env (PTyped l r) = ni env l ++ ni env r
2028 ni env (PPair _ _ l r) = ni env l ++ ni env r
2016 ni env (PPair _ _ l r) = ni env l ++ ni env r
@@ -2054,7 +2042,6 @@ usedNamesIn vars ist tm = nub $ ni [] tm
2054 ni env (PIfThenElse _ c t f) = concatMap (ni env) [c, t, f]
2042 ni env (PIfThenElse _ c t f) = concatMap (ni env) [c, t, f]
2055 ni env (PLam fc n _ ty sc) = ni env ty ++ ni (n:env) sc
2043 ni env (PLam fc n _ ty sc) = ni env ty ++ ni (n:env) sc
2056 ni env (PPi p n _ ty sc) = niTacImp env p ++ ni env ty ++ ni (n:env) sc
2044 ni env (PPi p n _ ty sc) = niTacImp env p ++ ni env ty ++ ni (n:env) sc
2057− ni env (PEq _ _ _ l r) = ni env l ++ ni env r
2058 ni env (PRewrite _ l r _) = ni env l ++ ni env r
2045 ni env (PRewrite _ l r _) = ni env l ++ ni env r
2059 ni env (PTyped l r) = ni env l ++ ni env r
2046 ni env (PTyped l r) = ni env l ++ ni env r
2060 ni env (PPair _ _ l r) = ni env l ++ ni env r
2047 ni env (PPair _ _ l r) = ni env l ++ ni env r