OASIS "Selective" 内部模块的未绑定模块错误
OASIS "Selective" Unbound module error for an internal module
我尝试使用 Oasis 编译一个小型 OCaml [4.03.0+flambda] 项目。我有四个模块,三个在模块字段中声明,一个使用 InternalModules。我的 _oasis 配置文件是 there.
内部模块名为Infix,包含一个子模块Option,收集了一些有用的中缀运算符来处理选项类型。在当前 github 版本的代码中,可用 here,一切正常,我能够构建项目。无论如何,如果我在源文件 agent.ml 中添加 "open Infix.Option" 行,那么它现在看起来像
[..LICENSE..]
open Lwt
open Cohttp
open Cohttp_lwt_unix
open Infix.Option
type http_status_code = Cohttp.Code.status_code
type http_headers = Cohttp.Header.t
[..]
我收到以下错误
+ /home/yann/.opam/4.03.0+flambda/bin/ocamlfind ocamlc -c -g -annot -bin-annot -package cohttp -package cohttp.lwt -package lambdasoup -package lwt -package uri -I src -o src/agent.cmo src/agent.ml
File "src/agent.ml", line 23, characters 5-17:
Error: Unbound module Infix.Option
这是出乎意料的,特别是因为我当前的源文件 page.ml 执行相同的打开并使用 Infix.Open 运算符而没有任何问题或错误。我想知道发生了什么以及为什么 agent.ml 和 page.ml 被 oasis 区别对待...
Lwt
有一个 Infix
模块,它隐藏了您的 Infix
模块。把打开的顺序倒过来就好了。
注意开Lwt
通常被认为不是很好的风格。如果您想使用 lwt 的中缀运算符,您应该改为打开 Lwt.Infix
。
我尝试使用 Oasis 编译一个小型 OCaml [4.03.0+flambda] 项目。我有四个模块,三个在模块字段中声明,一个使用 InternalModules。我的 _oasis 配置文件是 there.
内部模块名为Infix,包含一个子模块Option,收集了一些有用的中缀运算符来处理选项类型。在当前 github 版本的代码中,可用 here,一切正常,我能够构建项目。无论如何,如果我在源文件 agent.ml 中添加 "open Infix.Option" 行,那么它现在看起来像
[..LICENSE..]
open Lwt
open Cohttp
open Cohttp_lwt_unix
open Infix.Option
type http_status_code = Cohttp.Code.status_code
type http_headers = Cohttp.Header.t
[..]
我收到以下错误
+ /home/yann/.opam/4.03.0+flambda/bin/ocamlfind ocamlc -c -g -annot -bin-annot -package cohttp -package cohttp.lwt -package lambdasoup -package lwt -package uri -I src -o src/agent.cmo src/agent.ml
File "src/agent.ml", line 23, characters 5-17:
Error: Unbound module Infix.Option
这是出乎意料的,特别是因为我当前的源文件 page.ml 执行相同的打开并使用 Infix.Open 运算符而没有任何问题或错误。我想知道发生了什么以及为什么 agent.ml 和 page.ml 被 oasis 区别对待...
Lwt
有一个 Infix
模块,它隐藏了您的 Infix
模块。把打开的顺序倒过来就好了。
注意开Lwt
通常被认为不是很好的风格。如果您想使用 lwt 的中缀运算符,您应该改为打开 Lwt.Infix
。