Idris-dev/test/reg018/reg018a.idr
Edwin Brady 56bd9a1981 Look through call graph for mutual recursion when productivity checking
Otherwise we might miss non-productive calls, particularly important
when using 'with'.
Fixes issue #183
2013-05-10 18:41:12 +01:00

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