1
考虑:理解`decEq`
*section3> :module Data.Vect
*section3> :let e = the (Vect 0 Int) []
*section3> :let xs = the (Vect _ _) [1,2]
*section3> decEq xs e
(input):1:7:When checking argument x2 to function Decidable.Equality.decEq:
Type mismatch between
Vect 0 Int (Type of e)
and
Vect 2 Integer (Expected type)
Specifically:
Type mismatch between
0
and
2
为什么一定要Nat
参数彼此相当的DecEq?
注 - 张贴在https://groups.google.com/forum/#!topic/idris-lang/qgtImCLka3I原本
'的Vect 0 Int'和'的Vect 1 Int':
您可以先检查它们的长度,然后委托给同质版本写相同的元素类型的
Vect
ORS自己的异质平等决胜局与“Vect n Int”和“Vect n Float”是不同的类型。 – gallais