How can I open a module using a short name?

I use two open module methods in OCaml:

  1. let module M = SomeModule in code
    I can make a short name of a module, and use it in the expressions later.
  2. SomeModule.(code)
    This is really a shortcut in OCaml, it will open module in the scope.

But in ReScript, I only find one way to open module, it is:
open SomeModule
It works, but I must type the whole name of module, is there a way to open module in the OCaml way? I remember reasonml support the second way, I didn’t know how to write it in ReScript.

ReScript doesn’t support local open yet (SomeModule.(code)) but it’s on the roadmap.

For the first, you can simply do:

module M = SomeModule
3 Likes