noeq
type inj (t1 t2 : Type) = {
f : t1 -> t2;
}
let double (x:nat) : inj nat nat = {
f = (fun x -> x+1);
}
This fails with
- Subtyping check failed
- Expected type inj nat nat got type inj int int
The annotation on double should force the right instantiation for the implicits of the record constructor. Note this also fails even if we annotate that x is a nat:
- Subtyping check failed
- Expected type inj nat nat got type inj nat int