mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-24 12:14:26 +03:00
03d6c5f637
Co-authored-by: G. Allais <guillaume.allais@ens-lyon.org>
17 lines
304 B
Idris
17 lines
304 B
Idris
interface IsEven a where
|
|
isEven : a -> Bool
|
|
|
|
interface IsOdd b where
|
|
isOdd : b -> Bool
|
|
|
|
implementation IsOdd Nat
|
|
|
|
implementation IsEven Nat where
|
|
isEven 0 = True
|
|
isEven (S k) = not $ isOdd k
|
|
|
|
implementation Show Nat => IsOdd Nat where
|
|
isOdd 0 = True
|
|
isOdd (S k) = not $ isEven k
|
|
|