mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-19 09:12:34 +03:00
12 lines
209 B
Idris
12 lines
209 B
Idris
|
data IsS : Nat -> Type where
|
||
|
S : (n : Nat) -> IsS (S n)
|
||
|
|
||
|
isS : (n : Nat) -> Maybe (IsS n)
|
||
|
isS (S n) = Just (S n)
|
||
|
isS _ = Nothing
|
||
|
|
||
|
pred : Nat -> Nat
|
||
|
pred n with (isS n)
|
||
|
_ | Nothing = Z
|
||
|
_ | Just (S n) = n
|