I have just started to learn Ocaml. I'm using visual code as my IDE on Ubuntu, and I have OCaml extension and merlin installed.
and I have the following problem -
my workspace folder contains only 2 files: a.ml and b.ml.
In the file a.ml I have defined a module named "COOL", and in the file b.ml I wrote:
~ b.ml ~
open COOL;;
I get an error that says "Unbound module COOL merlin"
Is there any way to make it see the module on file a.ml? I tried searching for solution, I saw something with makefile and .merlin and B build but I didn't understand it, I don't have anything but the 2 files I mentioned. I would be happy if someone can tell me what exactly should be done in order for this little example to work.
tl; dr: do
ocamlc -c a.ml(or whatever your compilation command is) in order to generate thea.cmifile that merlin will use to get the list of symbols defined in moduleA.Apart the fact that in
b.mlyour module is indeed namedA.COOL(unless youopen Abeforeopen COOL) as mentioned by glennsl, the point is thatmerlinis, as far as I know, only watching the current file being edited, i.e.b.mlin your case. In order to have access to external symbols, you thus need to have compiled the other files (or at least their corresponding.mliif they exist), in order to have the relevant.cmifiles available to merlin.This is implicit in the paragraph of the documentation describing build paths, which says "[merlin] needs to know where to find the cmi files of the other modules of your project", i.e. those files need to exist in the first place.