Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Module types for multi-argument functors

$
0
0

I figured out one workable solution on my own, but I’d still be interested in others’ opinion.

My solution was to define a module types like so:

module type AType = { type t }
module type A_BType = { 
   module A : AType
   module B : { let x : A.t }
}

Then my Module Function is now:

module Example = (A_B : A_BType) => {
  open A_B
  ...
}

applied like so:

module MyExample = Example({ module A = MyA; module B = MyB })

Viewing all articles
Browse latest Browse all 2592

Trending Articles