Created
July 7, 2014 10:28
-
-
Save edwinb/43133bfa00db338cf116 to your computer and use it in GitHub Desktop.
Spot the difference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Elem : a -> Vect n a -> Type where | |
Here : Elem x (x :: xs) | |
There : Elem x xs -> Elem x (y :: xs) | |
isElem : DecEq a => (x : a) -> (xs : _) -> Maybe (Elem x xs) | |
isElem x [] = Nothing | |
isElem x (y :: xs) with (decEq x y) | |
isElem x (x :: xs) | (Yes refl) = Just Here | |
isElem x (y :: xs) | (No contra) = Just (There !(isElem x xs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment