on master help sign in
Remove some needless 'using' blocks

since the elaborator is now cleverer

commit505905da12edcb1084e2c9dbd0146b01349decbc authorEdwin Brady <ecb10@st-andrews.ac.uk> dateTue 8 Jul 2014, 13:32 (12 years ago) parent99ebe20
4 files changed+38−41
libs/base/Data/HVect.idr+2−2 libs/base/Data/List.idr+24−25 libs/base/Data/Vect.idr+4−5 libs/neweffects/Effects.idr+8−9
libs/base/Data/HVect.idr+2−2
@@ -17,7 +17,7 @@ using (k : Nat, ts : Vect k Type)
1717 index fZ (x::xs) = x
1818 index (fS j) (x::xs) = index j xs
1919
20− deleteAt : {us : Vect (S l) Type} -> (i : Fin (S l)) -> HVect us -> HVect (deleteAt i us)
20+ deleteAt : (i : Fin (S l)) -> HVect us -> HVect (deleteAt i us)
2121 deleteAt fZ (x::xs) = xs
2222 deleteAt {l = S m} (fS j) (x::xs) = x :: deleteAt j xs
2323 deleteAt {l = Z} (fS j) (x::xs) = absurd j
@@ -32,7 +32,7 @@ using (k : Nat, ts : Vect k Type)
3232 updateAt (fS j) f (x::xs) = x :: updateAt j f xs
3333
3434 ||| Append two `HVect`s.
35− (++) : {us : Vect l Type} -> HVect ts -> HVect us -> HVect (ts ++ us)
35+ (++) : HVect ts -> HVect us -> HVect (ts ++ us)
3636 (++) [] ys = ys
3737 (++) (x::xs) ys = x :: (xs ++ ys)
3838
libs/base/Data/List.idr+24−25
@@ -2,30 +2,29 @@ module Data.List
22
33%access public
44
5−using (xs : List a)
6− ||| A proof that some element is found in a list
7− data Elem : a -> List a -> Type where
8− Here : Elem x (x :: xs)
9− There : Elem x xs -> Elem x (y :: xs)
5+||| A proof that some element is found in a list
6+data Elem : a -> List a -> Type where
7+ Here : Elem x (x :: xs)
8+ There : Elem x xs -> Elem x (y :: xs)
109
11− instance Uninhabited (Elem {a} x []) where
12− uninhabited Here impossible
13− uninhabited (There p) impossible
10+instance Uninhabited (Elem {a} x []) where
11+ uninhabited Here impossible
12+ uninhabited (There p) impossible
1413
15− ||| Is the given element a member of the given list.
16− |||
17− ||| @x The element to be tested.
18− ||| @xs The list to be checked against
19− isElem : DecEq a => (x : a) -> (xs : List a) -> Dec (Elem x xs)
20− isElem x [] = No absurd
21− isElem x (y :: xs) with (decEq x y)
22− isElem x (x :: xs) | (Yes refl) = Yes Here
23− isElem x (y :: xs) | (No contra) with (isElem x xs)
24− isElem x (y :: xs) | (No contra) | (Yes prf) = Yes (There prf)
25− isElem x (y :: xs) | (No contra) | (No f) = No (mkNo contra f)
26− where
27− mkNo : {xs' : List a} ->
28− ((x' = y') -> _|_) -> (Elem x' xs' -> _|_) ->
29− Elem x' (y' :: xs') -> _|_
30− mkNo f g Here = f refl
31− mkNo f g (There x) = g x
14+||| Is the given element a member of the given list.
15+|||
16+||| @x The element to be tested.
17+||| @xs The list to be checked against
18+isElem : DecEq a => (x : a) -> (xs : List a) -> Dec (Elem x xs)
19+isElem x [] = No absurd
20+isElem x (y :: xs) with (decEq x y)
21+ isElem x (x :: xs) | (Yes refl) = Yes Here
22+ isElem x (y :: xs) | (No contra) with (isElem x xs)
23+ isElem x (y :: xs) | (No contra) | (Yes prf) = Yes (There prf)
24+ isElem x (y :: xs) | (No contra) | (No f) = No (mkNo contra f)
25+ where
26+ mkNo : {xs' : List a} ->
27+ ((x' = y') -> _|_) -> (Elem x' xs' -> _|_) ->
28+ Elem x' (y' :: xs') -> _|_
29+ mkNo f g Here = f refl
30+ mkNo f g (There x) = g x
libs/base/Data/Vect.idr+4−5
@@ -9,11 +9,10 @@ import Language.Reflection
99-- Elem
1010--------------------------------------------------------------------------------
1111
12−using (xs : Vect k a)
13− ||| A proof that some element is found in a vector
14− data Elem : a -> Vect k a -> Type where
15− Here : Elem x (x::xs)
16− There : Elem x xs -> Elem x (y::xs)
12+||| A proof that some element is found in a vector
13+data Elem : a -> Vect k a -> Type where
14+ Here : Elem x (x::xs)
15+ There : Elem x xs -> Elem x (y::xs)
1716
1817||| Nothing can be in an empty Vect
1918noEmptyElem : {x : a} -> Elem x [] -> _|_
libs/neweffects/Effects.idr+8−9
@@ -55,15 +55,14 @@ syntax "{" [inst] "==>" "{" {b} "}" [outst] "}" [eff]
5555syntax "{" [inst] "==>" [outst] "}" [eff] = eff inst (\result => outst)
5656
5757-- --------------------------------------- [ Properties and Proof Construction ]
58−using (xs : List a, ys : List a)
59− data SubList : List a -> List a -> Type where
60− SubNil : SubList {a} [] []
61− Keep : SubList xs ys -> SubList (x :: xs) (x :: ys)
62− Drop : SubList xs ys -> SubList xs (x :: ys)
63−
64− subListId : SubList xs xs
65− subListId {xs = Nil} = SubNil
66− subListId {xs = x :: xs} = Keep subListId
58+data SubList : List a -> List a -> Type where
59+ SubNil : SubList [] []
60+ Keep : SubList xs ys -> SubList (x :: xs) (x :: ys)
61+ Drop : SubList xs ys -> SubList xs (x :: ys)
62+
63+subListId : SubList xs xs
64+subListId {xs = Nil} = SubNil
65+subListId {xs = x :: xs} = Keep subListId
6766
6867namespace Env
6968 data Env : (m : Type -> Type) -> List EFFECT -> Type where