1

Let's say that I have an exe that has a function called compareTwoThings. I'd like compareTwoThings to be able to take, as arguments, two directories that have identical file names in each: a .json and a .fs. In compareTwoThings, I want to be able to read in each .json (easy-peasy) and each .fs file. The contents of each .fs file will be known.

How can I read in each .fs file and use the values in those .fs files without them being a part of the overall project structure? Can I? I understand that to build a project and have the project "see" into the .fs files, they need to be added to the .fsproj file, but can I not use open on an external file that has a module name?

Example dir structure of the proj:

myProj
    |-proj
        |-compareTwoThings.fs
        |-myProj.fs
        |-myProj.fsproj
Thing1
    |-Thing1.fs
    |-Thing1.json
Thing2
    |-Thing2.fs
    |-Thing2.json

And ultimately, the CLI statement would be something like

myProj compareTwoThings [dir to Thing1] [dir to Thing2] [output dir]

I feel like I'm overlooking something very simple here.

Edit: I do not believe that this question is related as I'm asking how to open a non-project .fs file.

Community
  • 1
  • 1
Steven
  • 3,238
  • 21
  • 50
  • 3
    It sounds like you want to read the .fs files and parse them (and import their functions into the execution environment). Correct? If so, have a look at FSharp Compiler Services. https://fsharp.github.io/FSharp.Compiler.Service/ – Robert Sim Apr 10 '17 at 14:34
  • @RobertSim Correct. Thanks for pointing out that library. I had never heard of it. I'll spend some time with it this morning. – Steven Apr 11 '17 at 13:08

0 Answers0