DEV Community

Dependency Injection in ReasonML using Modules

RawToast on January 31, 2020

When I wrote my first project in ReasonML I just imported modules from anywhere as that just seemed to be the way things were done. This was fine w...
Collapse
 
yawaramin profile image
Yawar Amin

Great article! Re:

I don't know what the preference is for calling these modules in Reason/OCaml,

I've typically seen them called Make, similarly to value-level make functions. And typically the signature is in the same module but called S. E.g.

// GameLoop.re

module type S = {
  ...
};

module Make = (Positions: Positions.S, EnemyLoop: EnemyLoop.S) => {
  ...
};

// Game.re

module Make = (GameLoop: GameLoop.S, ...) => {
  ...
};