mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-21 22:17:19 +03:00
56bd9a1981
Otherwise we might miss non-productive calls, particularly important when using 'with'. Fixes issue #183
22 lines
431 B
Idris
22 lines
431 B
Idris
module conat
|
|
|
|
%default total
|
|
|
|
codata CoNat = Z | S CoNat
|
|
|
|
infinity : CoNat
|
|
infinity = S infinity
|
|
|
|
plusCoNat : CoNat -> CoNat -> CoNat
|
|
plusCoNat Z x = x
|
|
plusCoNat (S x) y = S (plusCoNat x y)
|
|
|
|
--I don't think this should be definable
|
|
minusCoNat : CoNat -> CoNat -> CoNat
|
|
minusCoNat Z n = Z
|
|
minusCoNat (S n) Z = S n
|
|
minusCoNat (S n) (S m) = plusCoNat Z (minusCoNat n m)
|
|
|
|
loopForever : CoNat
|
|
loopForever = minusCoNat infinity infinity
|