on master help sign in
Merge pull request #2599 from scshunt/master

Use uninhabited instance for nonempty.

commitfa6a50ad5e8e0def71f5e286e75052648215feac authorDavid Christiansen <david@davidchristiansen.dk> dateThu 10 Sep 2015, 17:32 (11 years ago) parent70d197eb9e9c52
2 files changed+4−4
CONTRIBUTORS+1 libs/prelude/Prelude/List.idr+3−4
CONTRIBUTORS+1
@@ -44,3 +44,4 @@ Dirk Ullrich
4444Leif Warner
4545Daniel Waterworth
4646Jonas Westerlund
47+Sean Hunt
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`