鉴于以下代码...
type IMyInterface =
abstract BoolA : bool
abstract BoolB : bool
let myFn _boolVal (_i: IMyInterface) = if _boolVal then _i.BoolA else _i.BoolB
let myFnTrue = myFn true
let myFnFalse = myFn false
... Intellisense 抱怨,并且编译器失败,如果我在其中创建一个签名文件:
type IMyInterface =
abstract BoolA : bool
abstract BoolB : bool
val myFnTrue : (IMyInterface -> bool)
val myFnFalse : (IMyInterface -> bool)
错误是Error 10 Module 'MyModule' contains val myFnTrue : ('_a -> bool) when '_a :> MyModule.IMyInterface but its signature specifies val myFnTrue : (MyModule.IMyInterface -> bool) The types differ
。(报告了类似的错误myFnFalse
。)
我觉得自己像个白痴,无法弄清楚这一点。我究竟做错了什么?(支持“duh”的答案......)