on cb005bc help sign in
Idris-dev/test/effects003/VectMissing.idr
14 lines 307 B history raw
1module VectMissing
3import Data.Fin
4import Data.Vect
6instance Uninhabited (Elem x []) where
7 uninhabited Here impossible
9shrink : (xs : Vect (S n) a) -> Elem x xs -> Vect n a
10shrink (x :: ys) Here = ys
11shrink (y :: []) (There p) = absurd p
12shrink (y :: (x :: xs)) (There p) = y :: shrink (x :: xs) p