Idris2-boot/tests/idris2/basic015/George.idr
Edwin Brady e9a3167e2f Even more tests
Small change needed to fix one - assume given implicits which are of the
form x@_ arise from types. It's a bit of a hack but I don't think
there's any need for anything more complicated.
2019-06-27 20:19:00 +01:00

19 lines
465 B
Idris

data Vect : Nat -> Type -> Type where
Nil : Vect Z a
(::) : a -> Vect k a -> Vect (S k) a
data Elem : a -> Vect n a -> Type where
Here : Elem x (x :: xs)
There : {xs : Vect n a} -> Elem x xs -> Elem x (y :: xs)
getIndex : Elem x xs -> Nat
getIndex Here = 0
getIndex (There p) = S (getIndex p)
Beatles : Vect ? String
Beatles = ["John", "Paul", "George", "Ringo"]
georgeInBeatles : Elem "George" Beatles
georgeInBeatles = There (There Here)