1

I have the following file hierarchy:

foo.mlpack
Foo/
   bar.ml
   baz.ml
foo.ml

and I want to be able to do the following:

let () =
  Foo.Bar.some_func1 ();
  Foo.Baz.some_func2 ();
  Foo.some_func3 ()

How can I tell ocamlbuild to take foo.ml into account when creating the Foo module?

Edit 1

Thanks to the answer of daniel-bünzli, I was able to do what I wanted. So now, I'm in the following scenario:

_tags

foo.mllib
foo.ml
Foo/
   bar.ml
   baz.ml

toto.mllib
toto.ml
Toto/
    ...
    bar.ml
    ...

The problem now is that Toto.Bar seems to be occluded by Foo.Bar. I can't access Toto.Bar's content.

Edit 2

Ok in fact it's not a real problem.

I've just renamed Foo/bar.ml -> Foo/fooBar.ml.

So I have the following in foo.ml:

module Bar = FooBar

If I understand correctly, the guys from Jane Street do the same thing in Core_kernel with Core_list and some other modules.

Antoine
  • 1,782
  • 1
  • 14
  • 32

1 Answers1

4

Don't use mlpack.

Simply define your foo.ml as follows:

module Bar = Bar
module Baz = Baz
let some_func3 () = ...

Then simply define a .mllib with

Foo

Don't forget to <Foo> : include in your _tags file.

Daniel Bünzli
  • 5,119
  • 20
  • 21