Idris2 icon indicating copy to clipboard operation
Idris2 copied to clipboard

Idris allows very dependent types

Open Tasiro opened this issue 2 years ago • 2 comments

This is essentially the same issue as in Agda (see https://github.com/agda/agda/issues/1556).

Very dependent types allow an indexed type to use itself as an index. It can be quite useful, but may not be safe. I therefore expect Idris to reject the following:

mutual
    A: Type
    A = D AA

    data D: A -> Type where
        DD: D AA

    AA: A
    AA = DD

This may also be the reason that the following causes Idris to loop (and eat up my memory):

mutual
    B: Type
    B = C B
    data C: Type -> Type where
        CC: C B

Tasiro avatar Oct 31 '23 14:10 Tasiro

B = C B

This is straight up an infinite loop.

gallais avatar Oct 31 '23 14:10 gallais

And it is caught in

mutual
    B: Type
    data C: Type -> Type where
        CC: C B
    B = C B

Tasiro avatar Nov 01 '23 04:11 Tasiro