0
我得到这个当我编译我的代码在Haskell:期待一个不同类型的
Couldn't match type '[Char]' with 'Car a1 [Char]'
Expected type: [Car a1 [Char]]
Actual type: [[Char]]
我在哈斯克尔新的,不知道这意味着什么。我花了45分钟寻找答案,在我的情况下没有找到任何帮助。
这是第一个错误:
Couldn't match expected type '[[Char]]'
with actual type 'Car [Char] t0'
In the pattern: Leaf a
In an equation for 'evaluation': evaluation (Leaf a) = a
这是围绕它具有的问题的代码行。如果您希望我发布更多请让我知道,谢谢。
evaluation (Leaf a) = a
evaluation (Breakpoint "j" []) = 0
evaluation (Breakpoint "j" x:xs) = evaluation (x) + evaluation (Breakpoint "j" xs)
你能发布你试图编译的代码吗? –
请发布具有构造函数'Leaf'和'Breakpoint'的类型的定义,并且如果您可以输入'evaluation'的类型签名。 – bheklilr
我发现问题最终成为了什么。我创建了自己的总和和产品函数,并且它们已经在标准函数中声明,并且给了我这个错误。当我尝试更正我的代码时出现此错误。谢谢大家的时间。 – AbsoluteZ3r0