Is it a bug ? A missing features ? Does a alternative way exist ?
For now I do the same by copying every type/variables (see animalNaiveUpdater from the playground), but I would like to know if I can just “spread” them or something similar
EDIT: Also, in the playground, why my module B is not a pure module ? Can’t see any side effect… is it because it come from a function so it’s potentially have different type during runtime (even if it doesn’t in my case) ? Why my module NaiveC is not mark as unpure ? Any way to make my module B pure ? Thank’s !
I manage to do what I wanted by passing through a MiniAnimal module type which contain the type/data I want to keep. See the playground. Hope it help some of us !
But I still wondering if it’s kind of a bug/missing feature or if it’s expected (and why)
I want to add that, for this specific example, you would probably be much better off using records instead of first-class modules. The code will be easier to debug and require a fewer (or zero) type annotations. Using modules here instead of records is kind of like using a bulldozer where a simple shovel would suffice.
I realize that doesn’t answer the OP’s question, so feel free to disregard if you know that you need first-class modules anyway. I just don’t want anyone to over-complicate a simple problem by trying to use FCM where they aren’t required.