【发布时间】:2015-02-11 21:20:34
【问题描述】:
我认为最好用一个例子来解释:
type myRec = {x: string}
type myRec2 = {x: string}
let x = {x = "hello"}
let y(a: myRec) = a.x
y(x);;
y(x);;
--^
error FS0001: This expression was expected to have type
myRec
but here has type
myRec2
如果myRec 和myRec2 具有相同的签名,我如何强制x 具有myRec 类型?
【问题讨论】:
标签: f#