Implementing isLast with Idris
问题 Looking at exercise 9.2 from Type-Driven Development with Idris: data Last : List a -> a -> Type where LastOne : Last [value] value LastCons : (prf : Last xs value) -> Last (x :: xs) value Uninhabited (Last [] value) where uninhabited LastOne impossible uninhabited (LastCons _) impossible notLast : Not (x = value) -> Last [x] value -> Void notLast prf LastOne impossible notLast prf (LastCons _) impossible isLast : DecEq a => (xs : List a) -> (value : a) -> Dec (Last xs value) isLast [] value