【发布时间】:2020-07-31 20:02:57
【问题描述】:
根据this answer,F# 支持 OCaml 样式类型参数。问题中的例子是:
type 'a NestedList = List of 'a NestedList list | Elem of 'a
但是,我在 F# 文档的任何地方都找不到此语法,而且我无法让 F# 编译器接受我提供链接的答案中的语法。 编译器不接受这种使用多个参数的尝试:
type ('a * 'b) SomeType = ('a * 'b)
但是,这有效:
type ('a , 'b) SomeType = ('a * 'b)
let x:SomeType<int,int> = (4,5)
【问题讨论】: