【发布时间】:2011-11-02 14:37:25
【问题描述】:
1) 我有一个如下定义的开放联合:
type 'a choice = [> `One | `Other ] as 'a
然后我尝试定义一个类型choice_list:
type choice_list = choice list
这不起作用。如何定义一个或多个组件是开放联合的类型?
2) 如果我放弃创建choice_list 类型,而只使用choice list,当我尝试使用选择列表编写接口/签名语句时,
val choice_handler : choice list -> int
编译器抱怨type 'a choice = 'a constraint 'a = [> `One | `Other ] is not included in type infection_state. They have different arities。
我的问题是,如何在接口/签名中编写选择列表的类型声明。
【问题讨论】: