Idris2/tests/idris2/basic042/LiteralsInteger.idr
Giuseppe Lomurno c28133b7d9 Renamed IsString to FromString
- Renaming of the string overload interface
- Added test cases for both string and integer literals overload
2020-08-05 02:33:05 +02:00

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