Open andreasabel opened 1 month ago
Ok, I guess we don't need to protect type-based termination from postulates. The mere presence of them indicates that we are out of the safe zone.
This particular example exposes another problem: I do not support polarities yet. Maybe it makes sense to delay it until #6385 is merged.
Postulates should be handled like things in the context, e.g. module parameters. The following is (correctly) accepted:
{-# OPTIONS --type-based-termination #-}
data List A : Set where
[] : List A
_∷_ : A → List A → List A
module _ (mapList : {A B : Set} → (A → B) → List A → List B) where
data Rose (A : Set) : Set where
rose : List (Rose A) → Rose A
mapRose : {A B : Set} → (A → B) → Rose A → Rose B
mapRose f (rose rs) = rose (mapList (mapRose f) rs)
The
mapRose
example passes with definedList
andmapList
but fails when we turn them into postulates:It should not matter how
mapList
is defined as long as it is parametric. ATTN: @knisht