【发布时间】:2019-03-14 16:08:35
【问题描述】:
在下面的代码中,我得到了错误
无法将“Integer”类型与“Int”匹配
预期类型:[(Test, [Test])]
实际类型:[(Integer, [Integer])]
执行时
testFunc test
以下声明
type TestType = Int
a = [(1,[2,3])]
testFunc :: [(TestType ,[TestType])] -> TestType
testFunc ((a,(b:c)):d) = a
如何声明我的列表 a 以使其与 testFunc 的类型匹配?
有没有办法在不修改type Test = Int或a的声明的情况下修复错误?
【问题讨论】:
-
a = [(1::Int,[2::Int,3])]怎么样?
标签: haskell types type-mismatch