mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-19 09:12:34 +03:00
54 lines
745 B
Idris
54 lines
745 B
Idris
import Data.Integral
|
|
import Data.Nat
|
|
|
|
Cases : Type
|
|
Cases = List Bool
|
|
|
|
natEvenCases : Cases
|
|
natEvenCases = [
|
|
even 0,
|
|
even 2,
|
|
even 4,
|
|
even Z,
|
|
even (S (S Z))
|
|
]
|
|
|
|
natOddCases : Cases
|
|
natOddCases = [
|
|
odd 1,
|
|
odd 3,
|
|
odd 5,
|
|
odd (S Z),
|
|
odd (S (S (S Z)))
|
|
]
|
|
|
|
integralEvenCases : Cases
|
|
integralEvenCases = [
|
|
even (-4),
|
|
even (-2),
|
|
even 0,
|
|
even 2,
|
|
even 4
|
|
]
|
|
|
|
integralOddCases : Cases
|
|
integralOddCases = [
|
|
odd (-5),
|
|
odd (-3),
|
|
odd (-1),
|
|
odd 1,
|
|
odd 3,
|
|
odd 5
|
|
]
|
|
|
|
main : IO ()
|
|
main = do
|
|
printLn "Nat Even"
|
|
printLn natEvenCases
|
|
printLn "Nat Odd"
|
|
printLn natOddCases
|
|
printLn "Integral Even"
|
|
printLn integralEvenCases
|
|
printLn "Integral Odd"
|
|
printLn integralOddCases
|