on master help sign in
Fix binding rules in patterns

Names should only be implicitly bound in patterns if they begin with a lower case letter or _ (as in types), and we've always documented this but never actually enforced it! This has led to some mysterious and undetected bugs in Idris programs. This is likely to break some code (sorry) given that I've had to update a few tests to follow the new rules. However, the code it breaks is code that shouldn't have worked in the first place!

commitdb690778858de4b756f3b64a11763aa825574ea0 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateThu 25 Jan 2018, 21:09 (9 years ago) parent5205520
25 files changed+115−138
libs/contrib/Control/ST.idr+1−1 libs/prelude/Builtins.idr+1−1 libs/prelude/Prelude/WellFounded.idr+2−2 libs/pruviloj/Pruviloj/Core.idr+9−9 libs/pruviloj/Pruviloj/Derive/DecEq.idr+4−4 libs/pruviloj/Pruviloj/Disjoint.idr+2−2 libs/pruviloj/Pruviloj/Injective.idr+1−1 src/Idris/AbsSyntax.hs+6−1 src/Idris/Core/TT.hs+2−1 test/disambig002/disambig002.idr+2−2 test/dsl002/Resimp.idr+1−1 test/proof002/Reflect.idr+45−45 test/regression001/reg001.idr+1−1 test/regression001/reg004.lidr+14−14 test/regression001/reg046.idr+4−4 test/regression001/reg047.idr+2−2 test/regression001/reg047a.idr+1−1 test/regression001/reg062.lidr−41 test/regression001/reg064.idr+1−1 test/regression001/run+1−1 test/regression002/expected+8 test/regression002/reg002.idr+3 test/regression002/run+1 test/sugar005/As.idr+1−1 test/totality011/totality011.lidr+2−2
libs/contrib/Control/ST.idr+1−1
@@ -399,7 +399,7 @@ runST env (Write lbl prf val) k = k () (updateEnv prf env val)
399399runSTLoop : Fuel -> Env invars -> STransLoop m a invars outfn ->
400400 (k : (x : a) -> Env (outfn x) -> m b) ->
401401 (onDry : m b) -> m b
402−runSTLoop Empty _ _ _ onDry = onDry
402+runSTLoop Dry _ _ _ onDry = onDry
403403runSTLoop (More x) env (Bind prog next) k onDry
404404 = runST env prog (\prog', env' => runSTLoop x env' (next prog') k onDry)
405405runSTLoop (More x) env (Pure result) k onDry = k result env
libs/prelude/Builtins.idr+1−1
@@ -89,7 +89,7 @@ replace Refl prf = prf
8989||| in the other direction, which puts it in a form usable by the `rewrite`
9090||| tactic and term.
9191rewrite__impl : (P : a -> Type) -> x = y -> P y -> P x
92−rewrite__impl P Refl prf = prf
92+rewrite__impl p Refl prf = prf
9393
9494||| Symmetry of propositional equality
9595sym : {left:a} -> {right:b} -> left = right -> right = left
libs/prelude/Prelude/WellFounded.idr+2−2
@@ -60,8 +60,8 @@ accRec step z (Access f) =
6060accInd : {rel : a -> a -> Type} -> {P : a -> Type} ->
6161 (step : (x : a) -> ((y : a) -> rel y x -> P y) -> P x) ->
6262 (z : a) -> Accessible rel z -> P z
63−accInd {P} step z (Access f) =
64− step z $ \y, lt => accInd {P} step y (f y lt)
63+accInd {P=p} step z (Access f) =
64+ step z $ \y, lt => accInd {P=p} step y (f y lt)
6565
6666
6767||| Use well-foundedness of a relation to write terminating operations.
libs/pruviloj/Pruviloj/Core.idr+9−9
@@ -234,12 +234,12 @@ getTTType r = snd <$> check !getEnv r
234234both : Raw -> TTName -> TTName -> Elab ()
235235both tm n1 n2 =
236236 do -- We don't know that the term is canonical, so let-bind projections applied to it
237− (A, B) <- isPairTy !(getTTType tm)
238− remember n1 A; apply `(fst {a=~A} {b=~B} ~tm) []; solve
239− remember n2 B; apply `(snd {a=~A} {b=~B} ~tm) []; solve
237+ (a, b) <- isPairTy !(getTTType tm)
238+ remember n1 a; apply `(fst {a=~a} {b=~b} ~tm) []; solve
239+ remember n2 b; apply `(snd {a=~a} {b=~b} ~tm) []; solve
240240 where
241241 isPairTy : TT -> Elab (Raw, Raw)
242− isPairTy `((~A, ~B) : Type) = [| MkPair (forget A) (forget B) |]
242+ isPairTy `((~a, ~b) : Type) = [| MkPair (forget a) (forget b) |]
243243 isPairTy tm = fail [TermPart tm, TextPart "is not a pair"]
244244
245245||| Let-bind all results of completely destructuring nested tuples.
@@ -282,8 +282,8 @@ construct = case headName !goalType of
282282reflexivity : Elab ()
283283reflexivity =
284284 case !goalType of
285− `((=) {A=~A} {B=~_} ~x ~_) =>
286− do fill `(Refl {A=~A} {x=~x})
285+ `((=) {A=~a} {B=~_} ~x ~_) =>
286+ do fill `(Refl {A=~a} {x=~x})
287287 solve
288288 _ => fail [ TextPart "The goal is not an equality, so"
289289 , NamePart `{reflexivity}
@@ -307,9 +307,9 @@ symmetry =
307307symmetryAs : (t : Raw) -> (hint : String) -> Elab TTName
308308symmetryAs t hint =
309309 case !(getTTType t) of
310− `((=) {A=~A} {B=~B} ~l ~r) =>
311− do af <- forget A
312− bf <- forget B
310+ `((=) {A=~a} {B=~b} ~l ~r) =>
311+ do af <- forget a
312+ bf <- forget b
313313 lf <- forget l
314314 rf <- forget r
315315 let ts = the Raw $ `(sym {a=~af} {b=~bf} {left=~lf} {right=~rf} ~t)
libs/pruviloj/Pruviloj/Derive/DecEq.idr+4−4
@@ -82,7 +82,7 @@ partial
8282mkRhs : (fn, fam : TTName) -> Nat -> Elab ()
8383mkRhs fn fam k =
8484 case snd !getGoal of
85− `(Dec ((=) {A=~A} {B=~_} ~x ~y)) =>
85+ `(Dec ((=) {A=~_} {B=~_} ~x ~y)) =>
8686 let (c1, args1) = unApply x
8787 (c2, args2) = unApply y
8888 in if c1 /= c2
@@ -138,17 +138,17 @@ deriveDecEq : (fn : TTName) -> Elab ()
138138deriveDecEq fn =
139139 do (_, Ref, sig') <- lookupTyExact fn
140140 sig <- forget sig'
141− (args, `(Dec ((=) {A=~A} {B=~_} ~(Var x) ~(Var y)))) <- stealBindings sig noRenames
141+ (args, `(Dec ((=) {A=~aTy} {B=~_} ~(Var x) ~(Var y)))) <- stealBindings sig noRenames
142142 | other => fail [ TextPart "Return type"
143143 , RawPart (snd other)
144144 , TextPart "isn't decidable equality"
145145 ]
146146
147− datatype <- maybe (fail [ RawPart A
147+ datatype <- maybe (fail [ RawPart aTy
148148 , TextPart "is not an application of a TC"
149149 ])
150150 lookupDatatypeExact
151− (headName A)
151+ (headName aTy)
152152
153153 -- the signature must be like this:
154154 -- 1. a collection of variable bindings (will be implicit)
libs/pruviloj/Pruviloj/Disjoint.idr+2−2
@@ -78,7 +78,7 @@ disjoint =
7878 do compute
7979 g <- snd <$> getGoal
8080 case g of
81− `(((=) {A=~A} {B=~B} ~a ~b) -> Void) =>
81+ `(((=) {A=~aTy} {B=~bTy} ~a ~b) -> Void) =>
8282 do Just lHead <- headName <$> forget a
8383 | Nothing => fail [TermPart a, TextPart "doesn't have a name at the head"]
8484 Just rHead <- headName <$> forget b
@@ -101,7 +101,7 @@ discriminate =
101101 -- for each thing in the context, until we find one that succeeds
102102 flip choiceMap !getEnv $ \(n, b) =>
103103 do -- 1) check if it is an equality
104− `(((=) {A=~A} {B=~B} ~a ~b)) <- forget (binderTy b)
104+ `(((=) {A=~aTy} {B=~bTy} ~a ~b)) <- forget (binderTy b)
105105 | _ => fail [TextPart "Not equality type"]
106106 -- 2) check if both sides of the equality have heads
107107 case (headName a, headName b) of
libs/pruviloj/Pruviloj/Injective.idr+1−1
@@ -97,7 +97,7 @@ injective : (tm : Raw) -> (n : TTName) -> Elab ()
9797injective tm n =
9898 do (_, ty) <- check !getEnv tm
9999 case !(forget ty) of
100− `((=) {A=~A} {B=~B} ~x ~y) =>
100+ `((=) {A=~a} {B=~b} ~x ~y) =>
101101 case (headName x, headName y) of
102102 (Just xHd, Just yHd) =>
103103 if xHd /= yHd
src/Idris/AbsSyntax.hs+6−1
@@ -30,6 +30,7 @@ import Control.Applicative
3030import Control.Monad.State
3131import Prelude hiding (Applicative, Foldable, Traversable, (<$>))
3232
33+import Data.Char
3334import Data.Either
3435import Data.List hiding (insert, union)
3536import qualified Data.Map as M
@@ -1982,7 +1983,11 @@ aiFn topname inpat True qq imp_meths ist fc f ffc ds []
19821983 | inpat && implicitable f && unqualified f = Right $ PPatvar ffc f
19831984 | otherwise
19841985 = case lookupDef f (tt_ctxt ist) of
1985− [] -> Right $ PPatvar ffc f
1986+ [] -> case f of
1987+ MN _ _ -> Right $ PPatvar ffc f
1988+ UN xs | isDigit (T.head xs) -- for partial evaluation vars
1989+ -> Right $ PPatvar ffc f
1990+ _ -> Left $ Msg $ show f ++ " is not a valid name for a pattern variable"
19861991 alts -> let ialts = lookupCtxtName f (idris_implicits ist) in
19871992 -- trace (show f ++ " " ++ show (fc, any (all imp) ialts, ialts, any constructor alts)) $
19881993 if (not (vname f) || tcname f
src/Idris/Core/TT.hs+2−1
@@ -581,7 +581,8 @@ tcname _ = False
581581
582582implicitable (NS n _) = False
583583implicitable (UN xs) | T.null xs = False
584− | otherwise = isLower (T.head xs) || T.head xs == '_'
584+ | otherwise = isLower (T.head xs) ||
585+ T.head xs == '_'
585586implicitable (MN _ x) = not (tnull x) && thead x /= '_'
586587implicitable _ = False
587588
test/disambig002/disambig002.idr+2−2
@@ -8,7 +8,7 @@ Dec0 : Type -> Type
88Dec0 = Dec
99
1010Dec1 : {A : Type} -> (P : A -> Type) -> Type
11−Dec1 {A} P = (a : A) -> Dec0 (P a)
11+Dec1 {A=aTy} p = (a : aTy) -> Dec0 (p a)
1212
1313Unique : Type -> Type
1414Unique t = (p : t) -> (q : t) -> p = q
@@ -41,7 +41,7 @@ namespace Finite
4141
4242 ||| Notion of finiteness for types
4343 Finite : Type -> Type
44− Finite A = Exists (\ n => Iso A (Fin n))
44+ Finite a = Exists (\ n => Iso a (Fin n))
4545
4646 ||| Cardinality of finite types
4747 card : {A : Type} -> (fA : Finite A) -> Nat
test/dsl002/Resimp.idr+1−1
@@ -91,7 +91,7 @@ using (i: Fin n, gam : Vect n Ty, gam' : Vect n Ty, gam'' : Vect n Ty)
9191 Args gam as -> Args gam (interpTy a :: as)
9292
9393 funTy : List Type -> Ty -> Ty
94− funTy list.Nil t = t
94+ funTy List.Nil t = t
9595 funTy (a :: as) t = a :-> funTy as t
9696
9797 data Res : Vect n Ty -> Vect n Ty -> Ty -> Type where
test/proof002/Reflect.idr+45−45
@@ -6,7 +6,7 @@ import Decidable.Equality
66%default total
77%language FirstClassReflection
88
9−using (xs : List a, ys : List a, G : List (List a))
9+using (xs : List a, ys : List a, gam : List (List a))
1010
1111 data Elem : a -> List a -> Type where
1212 Stop : Elem x (x :: xs)
@@ -16,20 +16,20 @@ using (xs : List a, ys : List a, G : List (List a))
1616-- and over a set of list variables.
1717
1818 data Expr : List (List a) -> List a -> Type where
19− App : Expr G xs -> Expr G ys -> Expr G (xs ++ ys)
20− Var : Elem xs G -> Expr G xs
21− ENil : Expr G []
19+ App : Expr gam xs -> Expr gam ys -> Expr gam (xs ++ ys)
20+ Var : Elem xs gam -> Expr gam xs
21+ ENil : Expr gam []
2222
2323-- Reflection of list equalities, indexed over the concrete equality.
2424
2525 data ListEq : List (List a) -> Type -> Type where
26− EqP : Expr G xs -> Expr G ys -> ListEq G (xs = ys)
26+ EqP : Expr gam xs -> Expr gam ys -> ListEq gam (xs = ys)
2727
2828-- Fully right associative list expressions
2929
3030 data RExpr : List (List a) -> List a -> Type where
31− RApp : RExpr G xs -> Elem ys G -> RExpr G (xs ++ ys)
32− RNil : RExpr G []
31+ RApp : RExpr gam xs -> Elem ys gam -> RExpr gam (xs ++ ys)
32+ RNil : RExpr gam []
3333
3434-- Convert an expression to a right associative expression, and return
3535-- a proof that the rewriting has an equal interpretation to the original
@@ -38,7 +38,7 @@ using (xs : List a, ys : List a, G : List (List a))
3838-- The idea is that we use this proof to build a proof of equality of
3939-- list appends
4040
41− expr_r : Expr G xs -> (xs' ** (RExpr G xs', xs = xs'))
41+ expr_r : Expr gam xs -> (xs' ** (RExpr gam xs', xs = xs'))
4242 expr_r ENil = (_ ** (RNil, Refl))
4343 expr_r (Var i) = (_ ** (RApp RNil i, Refl))
4444 expr_r (App ex ey) = let (xl ** (xr, xprf)) = expr_r ex in
@@ -46,29 +46,29 @@ using (xs : List a, ys : List a, G : List (List a))
4646 appRExpr _ _ xr yr xprf yprf
4747 where
4848 appRExpr : (xs', ys' : List a) ->
49− {G : List (List a)} -> {xs, ys : List a} ->
50− RExpr G xs -> RExpr G ys -> (xs' = xs) -> (ys' = ys) ->
51− (ws' ** (RExpr G ws', xs' ++ ys' = ws'))
49+ {gam : List (List a)} -> {xs, ys : List a} ->
50+ RExpr gam xs -> RExpr gam ys -> (xs' = xs) -> (ys' = ys) ->
51+ (ws' ** (RExpr gam ws', xs' ++ ys' = ws'))
5252 appRExpr x' y' rxs (RApp e i) xprf yprf
5353 = let (xs ** (rec, prf)) = appRExpr _ _ rxs e Refl Refl in
5454 (_ ** (RApp rec i, ?appRExpr1))
5555 appRExpr x' y' rxs RNil xprf yprf = (_ ** (rxs, ?appRExpr2))
5656
57− r_expr : RExpr G xs -> Expr G xs
57+ r_expr : RExpr gam xs -> Expr gam xs
5858 r_expr RNil = ENil
5959 r_expr (RApp xs i) = App (r_expr xs) (Var i)
6060
6161-- Convert an expression to some other equivalent expression (which
6262-- just happens to be normalised to right associative form)
6363
64− reduce : Expr G xs -> (xs' ** (Expr G xs', xs = xs'))
64+ reduce : Expr gam xs -> (xs' ** (Expr gam xs', xs = xs'))
6565 reduce e = let (x' ** (e', prf)) = expr_r e in
6666 (x' ** (r_expr e', prf))
6767
6868-- Build a proof that two expressions are equal. If they are, we'll know
6969-- that the indices are equal.
7070
71− eqExpr : (e : Expr G xs) -> (e' : Expr G ys) ->
71+ eqExpr : (e : Expr gam xs) -> (e' : Expr gam ys) ->
7272 Maybe (e = e')
7373 eqExpr (App x y) (App x' y') with (eqExpr x x', eqExpr y y')
7474 eqExpr (App x y) (App x y) | (Just Refl, Just Refl) = Just Refl
@@ -83,20 +83,20 @@ using (xs : List a, ys : List a, G : List (List a))
8383-- they are equal
8484
8585 buildProof : {xs : List a} -> {ys : List a} ->
86− Expr G ln -> Expr G rn ->
86+ Expr gam ln -> Expr gam rn ->
8787 (xs = ln) -> (ys = rn) -> Maybe (xs = ys)
8888 buildProof e e' lp rp with (eqExpr e e')
8989 buildProof e e lp rp | Just Refl = ?bp1
9090 buildProof e e' lp rp | Nothing = Nothing
9191
92− testEq : Expr G xs -> Expr G ys -> Maybe (xs = ys)
92+ testEq : Expr gam xs -> Expr gam ys -> Maybe (xs = ys)
9393 testEq l r = let (ln ** (l', lPrf)) = reduce l in
9494 let (rn ** (r', rPrf)) = reduce r in
9595 buildProof l' r' lPrf rPrf
9696
9797-- Given a reflected equality, try to produce a proof that holds
9898
99− prove : ListEq G t -> Maybe t
99+ prove : ListEq gam t -> Maybe t
100100 prove (EqP xs ys) = testEq xs ys
101101
102102 getJust : (x : Maybe a) -> IsJust x -> a
@@ -114,15 +114,15 @@ using (xs : List a, ys : List a, G : List (List a))
114114 isElem x (x :: ys) | Just Refl = [| Stop |]
115115 isElem x (y :: ys) | Nothing = [| Pop (isElem x ys) |]
116116
117− weakenElem : (G' : List a) -> Elem x xs -> Elem x (G' ++ xs)
117+ weakenElem : (gam' : List a) -> Elem x xs -> Elem x (gam' ++ xs)
118118 weakenElem [] p = p
119− weakenElem (g :: G) p = Pop (weakenElem G p)
119+ weakenElem (g :: gam) p = Pop (weakenElem gam p)
120120
121− weaken : (G' : List (List a)) ->
122− Expr G xs -> Expr (G' ++ G) xs
123− weaken G' (App l r) = App (weaken G' l) (weaken G' r)
124− weaken G' (Var x) = Var (weakenElem G' x)
125− weaken G' ENil = ENil
121+ weaken : (gam' : List (List a)) ->
122+ Expr gam xs -> Expr (gam' ++ gam) xs
123+ weaken gam' (App l r) = App (weaken gam' l) (weaken gam' r)
124+ weaken gam' (Var x) = Var (weakenElem gam' x)
125+ weaken gam' ENil = ENil
126126
127127
128128-- Now, some reflection magic.
@@ -133,21 +133,21 @@ using (xs : List a, ys : List a, G : List (List a))
133133-- reduction will work the right way.
134134
135135%reflection
136−reflectList : (G : List (List a)) ->
137− (xs : List a) -> (G' ** Expr (G' ++ G) xs)
138−reflectList G [] = ([] ** ENil)
139−
140−reflectList G (x :: xs) with (reflectList G xs)
141− | (G' ** xs') with (isElem (List.(::) x []) (G' ++ G))
142− | Just p = (G' ** App (Var p) xs')
143− | Nothing = ([x] :: G' ** App (Var Stop) (weaken [[x]] xs'))
144−
145−reflectList G (xs ++ ys) with (reflectList G xs)
146− | (G' ** xs') with (reflectList (G' ++ G) ys)
147− | (G'' ** ys') = ((G'' ++ G') **
148− rewrite (sym (appendAssociative G'' G' G)) in
149− App (weaken G'' xs') ys')
150−reflectList G t with (isElem t G)
136+reflectList : (gam : List (List a)) ->
137+ (xs : List a) -> (gam' ** Expr (gam' ++ gam) xs)
138+reflectList gam [] = ([] ** ENil)
139+
140+reflectList gam (x :: xs) with (reflectList gam xs)
141+ | (gam' ** xs') with (isElem (List.(::) x []) (gam' ++ gam))
142+ | Just p = (gam' ** App (Var p) xs')
143+ | Nothing = ([x] :: gam' ** App (Var Stop) (weaken [[x]] xs'))
144+
145+reflectList gam (xs ++ ys) with (reflectList gam xs)
146+ | (gam' ** xs') with (reflectList (gam' ++ gam) ys)
147+ | (gam'' ** ys') = ((gam'' ++ gam') **
148+ rewrite (sym (appendAssociative gam'' gam' gam)) in
149+ App (weaken gam'' xs') ys')
150+reflectList gam t with (isElem t gam)
151151 | Just p = ([] ** Var p)
152152 | Nothing = ([t] ** Var Stop)
153153
@@ -160,12 +160,12 @@ reflectList G t with (isElem t G)
160160-- forms of equality proofs anyway.
161161
162162%reflection
163−reflectEq : (a : Type) -> (G : List (List a)) -> (P : Type) -> (G' ** ListEq (G' ++ G) P)
164−reflectEq a G (the (List a) xs = the (List a) ys) with (reflectList G xs)
165− | (G' ** xs') with (reflectList (G' ++ G) ys)
166− | (G'' ** ys') = ((G'' ++ G') **
167− rewrite (sym (appendAssociative G'' G' G)) in
168− EqP (weaken G'' xs') ys')
163+reflectEq : (a : Type) -> (gam : List (List a)) -> (P : Type) -> (gam' ** ListEq (gam' ++ gam) P)
164+reflectEq a gam (the (List a) xs = the (List a) ys) with (reflectList gam xs)
165+ | (gam' ** xs') with (reflectList (gam' ++ gam) ys)
166+ | (gam'' ** ys') = ((gam'' ++ gam') **
167+ rewrite (sym (appendAssociative gam'' gam' gam)) in
168+ EqP (weaken gam'' xs') ys')
169169
170170
171171-- Need these before we can test it or the reductions won't normalise fully...
test/regression001/reg001.idr+1−1
@@ -53,7 +53,7 @@ vfoldl P cons nil (x :: xs)
5353total soElim : (C : (b : Bool) -> So b -> Type) ->
5454 C True Oh ->
5555 (b : Bool) -> (s : So b) -> (C b s)
56−soElim C coh True Oh = coh
56+soElim c coh True Oh = coh
5757
5858soFalseElim : So False -> a
5959soFalseElim x = void (soElim C () False x)
test/regression001/reg004.lidr+14−14
@@ -6,9 +6,9 @@
66> (Functor F) => (Functor G) =>
77> (t : {A : Type} -> F A -> G A) ->
88> Type
9−> Natural {F} {G} t = {A, B : Type} ->
9+> Natural {F=fF} {G=gG} t = {A, B : Type} ->
1010> (f : A -> B) ->
11−> (x : F A) ->
11+> (x : fF A) ->
1212> t (map f x) = map f (t x)
1313
1414> Monotone : {B, C : Type} -> {F : Type -> Type} -> (Functor F) =>
@@ -16,13 +16,13 @@
1616> (LTE_C : C -> C -> Type) ->
1717> (measure : F B -> C) ->
1818> Type
19−> Monotone {B} {C} {F} LTE_B LTE_C measure =
19+> Monotone {B=bB} {C=cC} {F=fF} lte_B lte_C measure =
2020> {A : Type} ->
21−> (f : A -> B) ->
22−> (g : A -> B) ->
23−> (p : (a : A) -> f a `LTE_B` g a) ->
24−> (x : F A) ->
25−> measure (map f x) `LTE_C` measure (map g x)
21+> (f : A -> bB) ->
22+> (g : A -> bB) ->
23+> (p : (a : A) -> f a `lte_B` g a) ->
24+> (x : fF A) ->
25+> measure (map f x) `lte_C` measure (map g x)
2626
2727> monotoneNaturalLemma: {B, C : Type} -> {F : Type -> Type} -> (Functor F) =>
2828> (LTE_B : B -> B -> Type) ->
@@ -32,12 +32,12 @@
3232> (t : {A : Type} -> F A -> F A) ->
3333> Natural t ->
3434> Monotone LTE_B LTE_C (measure . t)
35−> monotoneNaturalLemma {B} {C} {F} LTE_B LTE_C m mm t nt = mmt where
35+> monotoneNaturalLemma {B=bB} {C=cC} {F=fF} lte_B lte_C m mm t nt = mmt where
3636> mmt : {A : Type} ->
37−> (f : A -> B) ->
38−> (g : A -> B) ->
39−> (p : (a : A) -> f a `LTE_B` g a) ->
40−> (x : F A) ->
41−> m (t {A = B} (map f x)) `LTE_C` m (t {A = B} (map g x))
37+> (f : A -> bB) ->
38+> (g : A -> bB) ->
39+> (p : (a : A) -> f a `lte_B` g a) ->
40+> (x : fF A) ->
41+> m (t {A = bB} (map f x)) `lte_C` m (t {A = bB} (map g x))
4242> mmt = ?kika
4343
test/regression001/reg046.idr+4−4
@@ -10,10 +10,10 @@ elimList : (A : Type) ->
1010 (f2 : (a : A) -> (as : MyList A) -> m as -> m (MyCons A a as)) ->
1111 (e : MyList A) ->
1212 m e
13−elimList A m f1 f2 (MyNil A) = f1
14−elimList A m f1 f2 (MyCons A a as) = f2 a as (elimList A m f1 f2 as)
13+elimList aA m f1 f2 (MyNil aA) = f1
14+elimList aA m f1 f2 (MyCons aA a as) = f2 a as (elimList aA m f1 f2 as)
1515
1616append : (A : Type) -> (b : MyList A) -> (c : MyList A) -> MyList A
17−append A b c = (elimList A (\ d => MyList A) c
18− (\ d => \ e => \ f => MyCons A d f)
17+append aA b c = (elimList aA (\ d => MyList aA) c
18+ (\ d => \ e => \ f => MyCons aA d f)
1919 b)
test/regression001/reg047.idr+2−2
@@ -6,10 +6,10 @@ data TTSigma : (A : Type) -> (B : A -> Type) -> Type where
66data Nat = Zero | Succ Nat
77
88Id : (A : Type) -> A -> A -> Type
9−Id A = (=) {A = A} {B = A}
9+Id aTy = (=) {A = aTy} {B = aTy}
1010
1111IdRefl : (A : Type) -> (a : A) -> Id A a a
12−IdRefl A a = Refl {x = a}
12+IdRefl aTy a = Refl {x = a}
1313
1414zzz : Id Nat Zero Zero
1515zzz = IdRefl Nat Zero
test/regression001/reg047a.idr+1−1
@@ -9,7 +9,7 @@ Id : (A : Type) -> A -> A -> Type
99Id = \A,x,y => x = y -- {a = A} {b = A}
1010
1111IdRefl : (A : Type) -> (a : A) -> Id A a a
12−IdRefl A a = Refl {x = a}
12+IdRefl aTy a = Refl {x = a}
1313
1414zzzz : Id MNat Zero Zero
1515zzzz = IdRefl MNat Zero
test/regression001/reg062.lidrdeleted−41
@@ -1,41 +0,0 @@
1−
2−This is a test to make sure that #2130 doesn't re-break.
3−
4−> import Data.Vect
5−> import Data.Fin
6−
7−> %default total
8−
9−> idSuccPreservesLTE : (m : Nat) -> (n : Nat) -> m `LTE` n -> m `LTE` (S n)
10−> idSuccPreservesLTE Z n prf = LTEZero
11−> idSuccPreservesLTE (S m) Z prf = absurd prf
12−> idSuccPreservesLTE (S m) (S n) prf = LTESucc (idSuccPreservesLTE m n (fromLteSucc prf))
13−
14−> ltZS : (m : Nat) -> LT Z (S m)
15−> ltZS Z = LTESucc LTEZero
16−> ltZS (S m) = idSuccPreservesLTE (S Z) (S m) (ltZS m)
17−
18−> record Preorder : {T : Type} -> (T -> T -> Type) -> Type where
19−> MkPreorder : {T : Type} ->
20−> (R : T -> T -> Type) ->
21−> (reflexive : (x : T) -> R x x) ->
22−> (transitive : (x : T) -> (y : T) -> (z : T) -> R x y -> R y z -> R x z) ->
23−> Preorder R
24−
25−> record TotalPreorder : {T : Type} -> (T -> T -> Type) -> Type where
26−> MkTotalPreorder : {T : Type} ->
27−> (R : T -> T -> Type) ->
28−> (reflexive : (x : T) -> R x x) ->
29−> (transitive : (x : T) -> (y : T) -> (z : T) -> R x y -> R y z -> R x z) ->
30−> (either : (x : T) -> (y : T) -> Either (R x y) (R y x)) ->
31−> TotalPreorder R
32−
33−> argmaxMax : {A : Type} -> {R : A -> A -> Type} -> TotalPreorder {T = A} R ->
34−> Vect n A -> LT Z n -> (Fin n, A)
35−> argmaxMax {n = Z} tp Nil p = absurd p
36−> argmaxMax {n = S Z} tp (a :: Nil) _ = (FZ, a)
37−> argmaxMax {A} {R} {n = S (S m)} (MkTotalPreorder R r t e) (a' :: (a'' :: as)) _
38−> with (argmaxMax (MkTotalPreorder {T = A} R r t e) (a'' :: as) (ltZS m))
39−> | (k, max) with (e a' max)
40−> | (Left _) = (FS k, max)
41−> | (Right _) = (FZ, a')
test/regression001/reg064.idr+1−1
@@ -5,4 +5,4 @@ sigmaEq2 : {A : Type} ->
55 fst s1 = fst s2 ->
66 snd s1 = snd s2 ->
77 s1 = s2
8−sigmaEq2 {A} {P} {s1 = (x ** prf)} {s2 = (x ** prf)} Refl Refl = Refl
8+sigmaEq2 {A=a} {P=p} {s1 = (x ** prf)} {s2 = (x ** prf)} Refl Refl = Refl
test/regression001/run+1−1
@@ -13,6 +13,6 @@ ${IDRIS:-idris} $@ --check \
1313${IDRIS:-idris} $@ --check --nobuiltins reg047.idr
1414
1515${IDRIS:-idris} $@ --check --nocolour \
16− reg062.lidr reg073.lidr
16+ reg073.lidr
1717
1818rm -f *.ibc
test/regression002/expected+8
@@ -5,6 +5,14 @@ reg001.idr:2:1-9:
55When checking left hand side of foo:
66Can't match on foo a a x
77
8+reg002.idr:3:1-19:
9+ |
10+3 | append (X :: XS) ys = X :: append XS ys
11+ | ~~~~~~~~~~~~~~~~~~~
12+When checking left hand side of append:
13+When checking argument x to constructor Prelude.List.:::
14+ X is not a valid name for a pattern variable
15+
816reg003a.idr:4:13-38:
917 |
10184 | ECons : Nat -> OddList -> EvenList
test/regression002/reg002.idrnew file+3
@@ -0,0 +1,3 @@
1+append : List a -> List a -> List a
2+append [] ys = ys
3+append (X :: XS) ys = X :: append XS ys
test/regression002/run+1
@@ -2,6 +2,7 @@
22
33${IDRIS:-idris} $@ --nobanner --nocolour --quiet --port none <<!
44:load reg001.idr
5+:load reg002.idr
56:load reg003.idr
67:load reg003a.idr
78:load reg006.idr
test/sugar005/As.idr+1−1
@@ -8,7 +8,7 @@ isS n@(S _) = Just n
88-- Test @ under a constructor
99hasS : List Nat -> Maybe Nat
1010hasS (Z::xs) = hasS xs
11−hasS (n@(S_)::xs) = Just n
11+hasS (n@(S _)::xs) = Just n
1212hasS _ = Nothing
1313
1414-- Test nested @s
test/totality011/totality011.lidr+2−2
@@ -20,10 +20,10 @@
2020> t'' `GTE` t
2121
2222> weCanOnlyGetOlder {t'' = Z} {t = Z} _ _ _ = LTEZero
23−> weCanOnlyGetOlder {t'' = Z} {t = S m} _ _ (Zeqt , _) =
23+> weCanOnlyGetOlder {t'' = Z} {t = S m} _ _ (zeqt , _) =
2424> void (uninhabited u) where
2525> u : Z = S m
26−> u = trans Zeqt Refl
26+> u = trans zeqt Refl
2727
2828> weCanOnlyGetOlder {t'' = S _} {t = S _} _ _ _ = ?foo
2929