OCaml是指mli中的ml文件中的模块

OCaml是指mli中的ml文件中的模块,ocaml,Ocaml,这里有一个文件set.ml,其中有一个名为IntSet的模块。如何在相应的接口文件set.mli中引用模块IntSet module IntSet = struct type t = int list;; let empty = [];; let rec is_member key = function | [] -> false | (x::xs) -> ( if x = key then true else is_member

这里有一个文件
set.ml
,其中有一个名为
IntSet
的模块。如何在相应的接口文件
set.mli
中引用模块
IntSet

module IntSet = struct
  type t = int list;;
  let empty = [];;
  let rec is_member key = function
    | [] -> false
    | (x::xs) -> (
      if x = key then true
      else is_member key xs
    );;
end;;

let join xs ys = xs @ ys;;
这里是
set.mli

val-join:IntSet.t->IntSet.t->IntSet.t

如果我试图编译它,我会得到一个错误,声称模块
IntSet
未绑定

% corebuild set.native
+ ocamlfind ocamlc -c -w A-4-33-40-41-42-43-34-44 -strict-sequence -g -bin-annot -short-paths -thread -package core -ppx 'ppx-jane -as-ppx' -o set.cmi set.mli
File "set.mli", line 1, characters 11-19:
Error: Unbound module IntSet
Command exited with code 2.
Hint: Recursive traversal of subdirectories was not enabled for this build,
  as the working directory does not look like an ocamlbuild project (no
  '_tags' or 'myocamlbuild.ml' file). If you have modules in subdirectories,
  you should add the option "-r" or create an empty '_tags' file.

  To enable recursive traversal for some subdirectories only, you can use the
  following '_tags' file:

      true: -traverse
      <dir1> or <dir2>: traverse

Compilation unsuccessful after building 3 targets (1 cached) in 00:00:00.
%corebuild set.native
+ocamlfind ocamlc-c-w A-4-33-40-41-42-43-34-44-严格顺序-g-bin annot-短路径-线程-包核心-ppx'ppx jane-as ppx'-o set.cmi set.mli
文件“set.mli”,第1行,字符11-19:
错误:未绑定模块IntSet
命令已退出,代码为2。
提示:此生成未启用子目录的递归遍历,
因为工作目录看起来不像ocamlbuild项目(否
“_标记”或“myocamlbuild.ml”文件)。如果子目录中有模块,
您应该添加选项“-r”或创建一个空的“\u tags”文件。
要仅对某些子目录启用递归遍历,可以使用
以下“\u标记”文件:
正确:-导线测量
或:导线测量
在00:00:00中生成3个目标(1个缓存)后编译失败。

如何公开在
set.ml
中定义的模块,以便在定义中使用它?

我将set.mli更改为此,编译器似乎很高兴:

module IntSet : sig type t end
val join : IntSet.t -> IntSet.t -> IntSet.t
可能还有更多的工作要做。例如,无法生成类型为
IntSet.t
的值