Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
OCaml共享约束_Ocaml - Fatal编程技术网

OCaml共享约束

OCaml共享约束,ocaml,Ocaml,我正在阅读中有关共享约束的内容,但无法通过更改模块类型签名来获得有关公开端点的部分 opencore 模块类型间隔\u intf=sig t型 类型端点 val创建:端点->端点->t val为空:t->bool val包含:t->endpoint->bool val相交:t->t->t 结束 模块Make_interval(端点:可比较):interval_intf=struct 类型endpoint=endpoint.t t型= |端点.t*端点.t的间隔 |空的 让我们创造低高= 如果En

我正在阅读中有关共享约束的内容,但无法通过更改模块类型签名来获得有关公开
端点的部分

opencore
模块类型间隔\u intf=sig
t型
类型端点
val创建:端点->端点->t
val为空:t->bool
val包含:t->endpoint->bool
val相交:t->t->t
结束
模块Make_interval(端点:可比较):interval_intf=struct
类型endpoint=endpoint.t
t型=
|端点.t*端点.t的间隔
|空的
让我们创造低高=
如果Endpoint.compare low high>0,则为空
else间隔(低、高)
let is_empty=函数
|空->真
|间隔时间->假
设包含t x=
匹配
|空->假
|间隔(l,h)->Endpoint.compare x l>=0&&Endpoint.compare x h Empty
|间隔(l1,h1),间隔(l2,h2)->创建(最大l1 l2)(最小h1 h2)
结束
模块Int\u interval\u intf:(端点类型为Int的interval\u intf)=生成间隔(Int)
这会产生一个错误:

Error: Signature mismatch:
       ...
       Type declarations do not match:
         type endpoint = Make_interval(Core_kernel__Int).endpoint
       is not included in
         type endpoint = int
这里有什么问题


这是w/OCaml 4.06.0和Core v0.11.3。

Make_interval
的结果类型的模块类型约束过于不透明。事实上,该约束使类型
端点
变得抽象。而且,由于它们不是在
Interval\u intf
签名中生成
端点
而不需要
端点
作为输入的函数,这使得生成的模块无用

module Make_interval(Endpoint: Comparable): Interval_intf with type endpoint = ...