I want to learn idris by writing a length function that checks the length of a tuple. I leanred a tuple is made by the MkPair constructor so I try to do pattern matching.
length : {t2:_} -> Pair t1 t2 -> Nat
length (MkPair a b) = case b of
MkPair c d => 1 + (length b)
_ => 2
Error: While processing right hand side of length. When unifying: t2 and: (?_, ?_) Mismatch between: t2 and (?_, ?_). coroutine:25:28--25:29 21 | Pair c d => 1 + (length b) 22 | _ => 2 23 | 24 | 25 | length (MkPair a b) = case b of ^
What does the error mean? How do I fix it? In deed I'm not sure if I used the case syntax correctly.