yago
yago

Reputation: 171

OASIS "Selective" Unbound module error for an internal module

I try to compile a small OCaml [4.03.0+flambda] project using Oasis. I have four modules, three declared in Modules field and one using InternalModules. My _oasis configuration file is there.

The internal module is named Infix, and contains a submodule Option that gathers some useful infix operators to deal with option types. In the current github version of the code, available here, everything work fine and I am able to build the project. Anyway, if I add the line "open Infix.Option" in the source file agent.ml so that it now looks like

[..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. I wonder what's happening and why agent.ml and page.ml are being treated differently by oasis...

Upvotes: 0

Views: 157

Answers (1)

Drup
Drup

Reputation: 3739

Lwt has an Infix module, which shadow your Infix module. Just reverse the order of opens.

Note that opening Lwt is often considered not very good style. If you want to use lwt's infix operator, you should open Lwt.Infix instead.

Upvotes: 2

Related Questions