【发布时间】:2013-03-09 00:07:33
【问题描述】:
我在浏览 ocaml 的标准库时,在 map.ml 文件中看到了这段代码。
module type S =
sig
type key
type +'a t
val empty: 'a t'
我想知道为什么会有type +'a t,以及为什么作者使用它而不是简单的'a t。
它的行为很奇怪,我无法推断出它的用法。
# type +'a t = 'a list;;
type 'a t = 'a list
# type +'a t = +'a list;;
Characters 13-14:
type +'a t = +'a list;;
^
Error: Syntax error
谢谢
【问题讨论】:
-
简街的相关帖子:blogs.janestreet.com/a-and-a