mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-21 02:31:50 +03:00
16 lines
347 B
Idris
16 lines
347 B
Idris
|
%default total
|
||
|
|
||
|
||| View for traversing a list backwards
|
||
|
public export
|
||
|
data SnocList : List a -> Type where
|
||
|
Empty : SnocList []
|
||
|
Snoc : (x : a) -> (xs : List a) ->
|
||
|
(rec : SnocList xs) -> SnocList (xs ++ [x])
|
||
|
|
||
|
empty : SnocList (x :: xs) -> a
|
||
|
empty Empty impossible
|
||
|
|
||
|
|
||
|
snoc : SnocList (x :: xs) -> a
|
||
|
snoc (Snoc _ _ _) impossible
|