OCaml 的 utop:导入外部模块

OCaml's utop: importing external modules

我有兴趣在我的项目中引入 Angstrom,一个解析组合器库。

我使用 opam 将 Angstrom 安装到我的系统中,如下所示:

$> opam install angstrom

我还使用 ocamlfind 参考相关模块成功编译了项目:

$> ocamlbuild -use-ocamlfind -pkgs 'angstrom' project.byte

令人惊讶的是,我无法将 Angstrom 导入 utop repl。 #open Angstrom 等命令指示绑定到模块名称的值。我已经从 repl 中搜索了模块导入的文档,但我没有找到我要找的结果。

utop 引用外部模块的最佳方法是什么?

我找到了问题的答案。来自 utop:

utop # #require "angstrom";;
utop # open Angstrom;;

对于过早发帖,我深表歉意,但希望以后有人会发现这个答案对您有所帮助。