1
我很不解,爲什麼第三個功能是行不通的:值限制的情況下在F#
let generate1 = id
let generate2 = let a = 1
id
let generate3 = printfn "hi"
id
而第2都很好,最後一個吐出
error FS0030: Value restriction. The value 'generate3' has been inferred to have generic type
val generate3 : ('_a -> '_a)
Either make the arguments to 'generate3' explicit or, if you do not intend for it to be generic, add a type annotation.
有罪的例子。價值限制和可證明的副作用之間的聯繫對我來說並不是微不足道的。我不會把這樣的錯誤信息methink。 – nicolas 2012-07-29 14:52:04