Aliasing functor's submodules

You can use the generalized open to bring definitions from a module into scope without exporting them, like this:

module Submodule = struct
  open Binary (String)
  include Submodule
end

(although this will copy all the fields of Submodule, which is a bit wasteful), or like this:

include struct
  open Binary(String)
  module Submodule = Submodule
end

(which won’t copy the fields)

1 Like