I have two F# modules, say a module called A in A.fs and B in B.fs. However, when I use module A from module B, F# does not see it. I've tried all combinations of open
directives, i.e., open A
, open MyNamespace.A
, and so on - nothing helps. What am I doing wrong?
I am guessing. The order the files appear in the project explorer is important. When you want to use module A from module B, A.fs has to appear before B.fs.
Since F# doesn't allow recursive modules (IIRC) the only thing you have to care about is that the order of modules is correct (you can't "forward declare" them) so that you build your adding a module that requires just the previous ones step by step.
If you ever find a situation in which you have a cyclic reference between a set of modules, then you will have to factor out the common part and remove the cycle.
This other question can clarify the topic: F# mutual recursion between modules
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With