mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-24 12:14:26 +03:00
c28133b7d9
- Renaming of the string overload interface - Added test cases for both string and integer literals overload
32 lines
441 B
Idris
32 lines
441 B
Idris
import Data.Fin
|
|
|
|
%default total
|
|
|
|
data ZeroOneOmega = Zero | One | Omega
|
|
|
|
Num ZeroOneOmega where
|
|
Zero + a = a
|
|
a + Zero = a
|
|
One + a = Omega
|
|
a + One = Omega
|
|
Omega + Omega = Omega
|
|
|
|
Zero * _ = Zero
|
|
_ * Zero = Zero
|
|
One * a = a
|
|
a * One = a
|
|
Omega * Omega = Omega
|
|
|
|
fromInteger 0 = Zero
|
|
fromInteger 1 = One
|
|
fromInteger _ = Omega
|
|
|
|
test1 : ZeroOneOmega
|
|
test1 = 0
|
|
|
|
test2 : ZeroOneOmega
|
|
test2 = 1
|
|
|
|
test3 : ZeroOneOmega
|
|
test3 = 8
|