mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-19 17:21:59 +03:00
13 lines
212 B
Idris
13 lines
212 B
Idris
|
data Natty : Nat -> Type where
|
||
|
Z : Natty Z
|
||
|
S : Natty n -> Natty (S n)
|
||
|
|
||
|
view : (n: Nat) -> Natty n
|
||
|
view Z = Z
|
||
|
view (S n) = S (view n)
|
||
|
|
||
|
id : Nat -> Nat
|
||
|
id n with (view n)
|
||
|
id _ | Z = Z
|
||
|
id _ | S n = id _ | n
|