Consider the following fragment:
import Data.List
%default total
x : Elem 1 [1, 2]
x = Here
type : Type
type = Elem 1 [1, 2]
y : type
y = Here
This gives the error:
When checking right hand side of y: Type mismatch between Elem x (x :: xs) (Type of Here) and iType (Expected type)
The type of y
, when queried, is:
type : Type
-----------
y : type
Is it possible to force type
to be evaluated during or before the type ascription of y
, so that the type of y
is Elem 1 [1, 2]
?
My use case is that I want to be able to define generic predicates that return the right proposition terms for proofs, for example:
subset : List a -> List a -> Type
subset xs ys = (e : a) -> Elem e xs -> Elem e ys
thm_filter_subset : subset (filter p xs) xs