简体   繁体   English

OASIS内部模块的“选择性”未绑定模块错误

[英]OASIS “Selective” Unbound module error for an internal module

I try to compile a small OCaml [4.03.0+flambda] project using Oasis. 我尝试使用Oasis编译一个小的OCaml [4.03.0 + flambda]项目。 I have four modules, three declared in Modules field and one using InternalModules. 我有四个模块,三个在Modules字段中声明,一个使用InternalModules。 My _oasis configuration file is there . 我的_oasis配置文件在那里

The internal module is named Infix, and contains a submodule Option that gathers some useful infix operators to deal with option types. 内部模块名为Infix,它包含一个子模块Option,该子模块收集一些有用的infix运算符以处理选项类型。 In the current github version of the code, available here , everything work fine and I am able to build the project. 这里的代码的当前github版本中,一切正常,我能够构建项目。 Anyway, if I add the line "open Infix.Option" in the source file agent.ml so that it now looks like 无论如何,如果我在源文件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
[..]

and I get the following error 我得到以下错误

+ /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

which is unexpected, especially because my current source file page.ml performs the same open and uses Infix.Open operators without any problem or error. 这是意外的,特别是因为我当前的源文件page.ml执行相同的打开操作并使用Infix.Open运算符而没有任何问题或错误。 I wonder what's happening and why agent.ml and page.ml are being treated differently by oasis... 我想知道发生了什么,为什么绿洲对agent.ml和page.ml的处理方式有所不同...

Lwt has an Infix module, which shadow your Infix module. Lwt有一个Infix模块,可Lwt您的Infix模块。 Just reverse the order of opens. 只需反转打开顺序即可。

Note that opening Lwt is often considered not very good style. 注意,打开Lwt通常被认为不是很好的样式。 If you want to use lwt's infix operator, you should open Lwt.Infix instead. 如果要使用lwt的infix运算符,则应打开Lwt.Infix

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM