Jos*_*tor 3 ocaml module subtype
假设我有以下设置
module type FOO = sig type f val do_foo : f end
module type BAR = sig type b val do_bar : b end
module type FOOANDBAR =
sig
include FOO
include BAR
end
Run Code Online (Sandbox Code Playgroud)
现在我想(以一种很好的方式,也就是说,没有复制界面,因此FOO和BAR仍然是子类型)强制执行类型f和类型b相同的限制.
有没有一种很好的方法在OCaml中执行此操作,可能使用include关键字的一些不同方法?
谢谢!!-约瑟夫
module type FOOANDBAR =
sig
include FOO
include (BAR with type b = f)
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
432 次 |
| 最近记录: |