当我在伊德里斯尝试这个时,
contrived : (List a, Char, (Int, Double), String, Bool) -> Bool
contrived ([] , 'b', (1, 2.0), "hi" , True) = False
contrived (a, b, c, d, e) = True
我收到错误消息Can't infer argument a to contrived, Can't infer argument a to List, Can't infer argument a to []
。但是看看Manning的书,我的方法没有看到任何明显的句法问题。
答案 0 :(得分:4)
您收到错误消息,因为Idris现在想要在REPL中调用函数时类型Should be Replaced With you domain
(或更确切地说是[])。您可以指定这样的隐含信息,如下所示:
a
或者像这样:
contrived {a = Nat} ([], 'b', (1, 2.0), "hi" , True)
> False
在contrived (the (List Nat) [], 'b', (1, 2.0), "hi" , True)
> False
计划中不需要:
true