Problem
The import module pattern is a common pattern used to reduce the number of qualified names in a library. It consists of writing an import.ml consisting of aliases like:
And then doing open Import in every other module.
The problem with this pattern is that it completely defeats the optimization in #14021.
Solution
We need to lift this import module pattern to the level of dune files so that dune understands all the aliases in scope. Here's a simple way to do so:
(library
(imported_modules (lib foo bar ..))
..)
Where the first token is the name of the library, and the rest are module names.
Now dune should be able to know which modules are in scope when refining library dependencies.
Problem
The import module pattern is a common pattern used to reduce the number of qualified names in a library. It consists of writing an
import.mlconsisting of aliases like:And then doing
open Importin every other module.The problem with this pattern is that it completely defeats the optimization in #14021.
Solution
We need to lift this import module pattern to the level of dune files so that dune understands all the aliases in scope. Here's a simple way to do so:
Where the first token is the name of the library, and the rest are module names.
Now dune should be able to know which modules are in scope when refining library dependencies.