-
-
Save kuribas/eada8c691e93e2b519dfb21959d9806e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data NonEmptyList : List a -> Type where | |
NonEmpty : NonEmptyList (x :: xs) | |
safeTail : (xs : List a) -> {auto prf : NonEmptyList xs} -> List a | |
safeTail (_ :: xs) = xs | |
test : List Int | |
test = [1, 2, 3] | |
-- type error, empty list | |
-- badTail : List Int | |
-- badTail = safeTail [] | |
goodTail : List Int | |
goodTail = safeTail [1, 2, 3] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment