I think my problem is that having a module type intended for use by a Module Function, when having an abstract type, the Module Function only sees the abstract type as abstract (Ok that probably didn’t make any sense), a better explanation is in the comments
module type FunctorType = {
type a
// "type a = string" works but I want to set the type in MyMod
let injectedRun: a => unit
}
module Functor = (R: FunctorType) => {
let runInjectedRun = x => R.injectedRun(x)
}
module MyMod: FunctorType = {
type a = string // this is where I want to set the type
let injectedRun = (x: a) => Console.log(x)
}
module NewMod = Functor(MyMod)
NewMod.runInjectedRun("hello") // This has type: string But this function argument is expecting: MyMod.a
I think this is just simply this problem below. I’m probably wrongly thinking of MyModType as kind of a base module that has abstract members that need to be overwritten, but I guess that’s not how we do things around here.
module type MyModType = {
type a
}
module MyMod: MyModType = {
type a = int
}
let x: MyMod.a = 1 // This has type: int But it's expected to have type: MyMod.a