In your case, though. Something I would try is to write a script, that would scan the directory, and produce a .res file with content like this:
module type Log = {
let log: unit => unit
}
let logImplementations: array<module(Log)> = [
// composed by the script based on files' names
module(Log1),
module(Log2)
]
Then, having this generated code, you can use it like so: