For example, Agda allows me to write this:
open import Data.Vec
open import Data.Nat
myVec : Vec ℕ _
myVec = 0 ∷ 1 ∷ 2 ∷ 3 ∷ []
and myVec
will have type Vec ℕ 4
as expected.
But if I try the same in Idris:
import Data.Vect
myVec : Vect _ Nat
myVec = [0, 1, 2, 3]
I get an error message from the typechecker:
When checking right hand side of myVec with expected type
Vect len Nat
Type mismatch between
Vect 4 Nat (Type of [0, 1, 2, 3])
and
Vect len Nat (Expected type)
Specifically:
Type mismatch between
4
and
len
Is there a way to define myVec
in Idris without manually specifying the index of the Vect
?