OCaml 语句的实际含义是什么?
let func (v: A.a) : unit =
#rest of the function
- 这是否意味着它需要 Aa 类型的 v 并返回单元
- 或者它需要两个参数 v 和 Aa 并返回一个单位?
- 或者它需要一个带有参数 Aa 的函数 v 并返回一个单位?
- 或者是其他东西?
OCaml 语句的实际含义是什么?
let func (v: A.a) : unit =
#rest of the function
let func (v: A.a) : unit =
第一种:意思v is a parameter and its type is expected to be A.a。
第二种:意思func is expected to return a type of unit
1,也许是 3。在 OCaml 中,函数是值,如果A.a是函数类型,你的第一个参数func是函数。
意思是1。
也就是说,如果v有 type A.a,则func v有 type unit。
或者,等效地,类型func是A.a -> unit。