Does anyone know why Idris 2 can’t figure this out? I have to explicitly tell it that xs matches _::_, even though it knows xs can’t match Nil (because it’s in the wrong case)
(This also happens with case..of)
was working on for Aya?
For this specific issue, you might need to help Idris along by matching on the implicit `n` parameter. This might let you remove the redundant case. https://twitter.com/OwoTizusa/status/1461181965923725317…
so the top definition works, but if I try to match on the implicit parameter (last') Idris yells at me because `n` is only accessible at compile time :(
Ohhhh so idris erases implicit variables by default I think. Ie. you can't match on them if they are erased at runtime! I believe there is a way to make these usable at runtime though, lemme check.
Ahh yeah, what I said here: https://twitter.com/brendanzab/status/1465638202048331781…
Think the trick is knowing that Idris _generalises_ this:
last : Vect (S n) a -> a
to this:
last : {0 n : Nat} -> Vect (S n) a -> a
where as we really want:
last : {n : Nat} -> Vect (S n) a -> a
On I think it is just `{n : Nat} -> Vect (S n) a -> a` - it's the lowercase, auto-generalised variables it automatically sets to be 'erased' (ie. to a 0 multiplicity).
On I think it is just `{n : Nat} -> Vect (S n) a -> a` - it's the lowercase, auto-generalised variables it automatically sets to be 'erased' (ie. to a 0 multiplicity).