on master help sign in
Use uninhabited instance for nonempty.
commit8501e6d93bd935fd69453bb55bdd117e124676c2 authorSean Hunt <scshunt@csclub.uwaterloo.ca> dateThu 10 Sep 2015, 09:18 (11 years ago) parent70d197e
1 file changed+3−4
libs/prelude/Prelude/List.idr+3−4
libs/prelude/Prelude/List.idr+3−4
@@ -52,13 +52,12 @@ data NonEmpty : (xs : List a) -> Type where
5252 ||| The proof that a cons cell is non-empty
5353 IsNonEmpty : NonEmpty (x :: xs)
5454
55−private
56−nonEmptyNil : NonEmpty [] -> Void
57−nonEmptyNil IsNonEmpty impossible
55+instance Uninhabited (NonEmpty []) where
56+ uninhabited IsNonEmpty impossible
5857
5958||| Decide whether a list is non-empty
6059nonEmpty : (xs : List a) -> Dec (NonEmpty xs)
61−nonEmpty [] = No nonEmptyNil
60+nonEmpty [] = No absurd
6261nonEmpty (x :: xs) = Yes IsNonEmpty
6362
6463||| Satisfiable if `k` is a valid index into `xs`