How do I resolve type mismatch arising due to a Functor?

Here is a simplified example of a Functor setup in my codebase. The module Number which is a module of type Item, is passed as an argument to functor Make. The resulting types SpecificItem.t and Number.t are (to my eyes, but not to the compiler) the same. Hence the compiler calls out the type mismatch on this line:

let integers = values->

This (values) has type: array<SpecificItem.t>
  Somewhere wanted: 'a => 'b

But how do I reconcile the types array<SpecificItem.t> with array<Number.t> for this line of code?

You are using (which is data last), combined with first pipe (->).

If you use instead, everything compiles:

1 Like

Thank you! I misunderstood the compiler message.

My codebase uses JS/Belt/ReScriptCore and it’s transitioning to RescriptCore. I should have figured that out :sweat_smile: .

I suggest taking a look at GitHub - DZakh/rescript-stdlib-vendorer: Tool to support usage of a vendored standard library in ReScript. It’ll help with transition and prevent the Js/Belt usage in the future.

1 Like