mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-30 07:02:24 +03:00
30 lines
477 B
Idris
30 lines
477 B
Idris
|
data NonEmpty : List a -> Type where
|
||
|
IsNonEmpty : NonEmpty (x :: xs)
|
||
|
|
||
|
head : (xs : List a) -> NonEmpty xs => a
|
||
|
head (x :: xs) = x
|
||
|
|
||
|
failing "Can't find an implementation for NonEmpty xs."
|
||
|
myHead : List a -> a
|
||
|
myHead xs = head xs
|
||
|
|
||
|
failing "Can't find
|
||
|
an implementation
|
||
|
for NonEmpty xs."
|
||
|
myHead : List a -> a
|
||
|
myHead xs = head xs
|
||
|
|
||
|
|
||
|
failing "Can't
|
||
|
find
|
||
|
|
||
|
|
||
|
an implementation
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
for NonEmpty xs."
|
||
|
myHead : List a -> a
|
||
|
myHead xs = head xs
|