F#泛型方法无法解析我的类型规范?

时间:2016-02-18 10:13:08

标签: parsing generics methods f#

在fsi中,我输入了:

> let f (x:'a) (y:'b)=x + y
- ;;

  let f (x:'a) (y:'b)=x + y
  ----------------------^

stdin(25,23): warning FS0064: This construct causes code to be less generic     
than indicated by the type annotations. The type variable 'b has been   
constrained to be type 'int'.

val f : x:int -> y:int -> int

好吧,我的目标是定义" f"能够接收2个参数,但似乎解释器无法理解我的需要并解析f为int-> int-> int?为什么呢?

0 个答案:

没有答案