mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-22 11:13:36 +03:00
e58bcfc7ef
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
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
|