Idris2/tests/idris2/with/with008/WithClause.idr

12 lines
209 B
Idris
Raw Normal View History

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