【发布时间】:2015-01-02 15:07:57
【问题描述】:
我有以下代码
let bar foo baz = foo, baz
let z = bar 3
let z1 = z 2
但是如果我注释掉最后一行 let z1 = z 2 我会得到一个错误
let z = bar 3
----^
stdin(78,5): error FS0030: Value restriction.
The value 'z' has been inferred to have generic type
val z : ('_a -> int * '_a)
Either make the arguments to 'z' explicit or, if you do not intend for it to be generic,
add a type annotation.
我完全不知道如何正确注释函数。
【问题讨论】:
标签: types f# type-inference