KolA
KolA

Reputation: 766

Isolate modules within one F# project using folders - is it possible?

I like the way F# requires to organize files and code in order of dependency because it discourages mindless coupling.

I have flat list of source files atm (simplified):

Common.fs
Workflow1.fs
Workflow2.fs

And want to go one step beyond. First, organize files like this (VS 2017 can't move folders up and down, one needs to edit .fsproj but it is different story - at least it is possible):

Common.fs
Workflow1\Impl1.fs
Workflow2\Impl2.fs

I expected Impl1.fs and Impl2.fs to be fully isolated from each other because their folders are not in parent/child relationship, but Impl2.fs can easily see types and functions from Impl1.fs: just open module and they are available

Are there any techniques to keep them isolated? It's possible to split the project in three however I prefer to keep DLL as a unit of deployment: workflows are small and ideally I want to avoid to have many tiny DLL files.

Upvotes: 1

Views: 132

Answers (2)

Aaron M. Eshbach
Aaron M. Eshbach

Reputation: 6510

You can't isolate the folders that way, as far as I know. However, if you want to keep them isolated at compile time but deployable as a single unit, you can create separate projects and use Fody or ILMerge to combine the assemblies post-compilation.

Upvotes: 2

Wallace
Wallace

Reputation: 17508

It sounds like you have a good understanding of what your options are. You are not missing anything else. Consequently, the answer to your question is, "no."

Upvotes: 3

Related Questions