Merlin not understanding Eio?

I’m trying to learn eio and following the examples in the eio GitHub repo. Everything works great but my Emacs, which has a usual setup with tuareg, merlin, etc., doesn’t understand the Eio module. It says “Unbound module” for modules like Eio, Eio.Std, etc. But it does understand Eio_main. Here’s the screenshot.

eio

When I try to auto-complete those module names, I get modules that look like internal names instead. For example, I get Eio__.Buf_read instead of Eio.Buf_read. Is this a known issue? Or am I doing something wrong?

Do you have a dune build system around your file that explicitly adds eio as a dependency? If not, you may have to write a .merlin file by hand to let it know that it needs to load Eio to make sense of your project.

Yes I do. I added both eio and eio_main. The same setup works for other packages so I doubt my setup with Emacs+dune+merlin+tuareg is problematic. But who knows…

Adding .merlin didn’t help either. When I add eio and eio_main to .merlin, Emacs understands Eio_main but not Eio or Eio.Std, etc. When I add only eio, it doesn’t understand Eio_main too, which is expected.

When I look at the ~/.opam/default/lib/eio directory, I see files like eio__.cmi, eio__cmt, eio__.cmx as well as eio.cmi, eio.cmt, eio.cmx, etc. Merlin knows about the Eio__ module but not about Eio module. Maybe it’s confused between the two.

It turns out to be my fault. I named my file eio.ml, creating another Eio module locally. :man_facepalming:

4 Likes