I have the following function:
natListLast : List ℕ → ℕ
natListLast nats = v.last (v.fromList nats)
and I currently get this error:
l.foldr (λ _ → suc) 0 nats != suc _n_126 of type ℕ
when checking that the expression fromList nats has type
Vec ℕ (1 + _n_126)
I would like to know how I can call last
on v.fromList nats
when v.fromList
returns Vec A (length xs)
. How can I tell the compiler that length xs
is equal to 1 + _n_126
?
Thanks!
I also tried doing:
natListLast : List ℕ → ℕ
natListLast nats = v.last {l.length nats} (v.fromList nats)
since last
has this signature:
last : ∀ {n} → Vec A (1 + n) → A
I thought that I could pass the length of nats in as the implicit argument for last
but I get this error:
ℕ !=< Level
when checking that the inferred type of an application
ℕ
matches the expected type
Level