I've recently picked up F#, and am currently working on a command line utility to help automate some work related tasks. I have implemented a command parser, and a Union for my the different command options, and it all works fine.
When I get to the execution part depending on the options something seems to break though.
Lets say I have a module with 2 functions that I want to run depending on the result of the command input
module OptionRunner
let option1 a b = a + b
let option2 c d = c |> Seq.map(fun i-> i + d)
Now my determiner will look like:
let runCommands =
if option.opt1 then
option1
else if options.opt2 then
option2
This might be over-simplified, but hopefully gives a fair understanding of what I am trying to accomplish.
Now, my problem is that whatever I do in runCommands, and however many different functions I have in my OptionRunner module it ALWAYS calls option1
, and then continues through the entire list of functions in that module.
I have even tried creating local modules for each function to test it. It still ALWAYS called option1.
I cannot see a difference between my indentation or module structure from this file to any other module in the project (where there are no problems)
Has anyone experienced and solved this? It's been driving me nuts.