I think this is generally less uniform than it is in some other communities, so most of these have a sort of either-or answer:
-
One common structure is the
lib
,bin
,test
layout. This is promoted by Real World OCaml and is also what you get if you use saydune init project
. That said, I also have projects that just have asrc/
folder that contains both “library”/implementation code and an executable stub, and atest/
folder for any tests. -
This may not be what you’re asking, but the only real navigational naming convention I can think of is that many modules will have a “core type” just named
t
. The standard library has this with e.g. theResult
module definingResult.t
-
I handle dependencies by having each project manage its own
opam switch
. If I was just learning I would probably use local switches, but by now I’m used to just differently-named global switches. I believe the major alternative here is using something like opam-monorepo -
For testing I mainly use a mix of inline/expect testing and cram-style testing. Both of these are run with
dune runtest