I have a fsx file that I use for interactive development of my project. It preloads all the dlls plus I want to mock a couple of functions that should behave differently in FSI world.
In fsx I have this code:
// #r needed dlls
open FSharp.Charting
module InteractiveUtil =
let plotMe (c : ChartTypes.GenericChart) = c.ShowChart() |> ignore
let logMe (c : string) = c |> printfn "%s"
Now in .fs files I want to play with I have this:
#if INTERACTIVE
#load "LiveInvestigationPreload.fsx"
open InteractiveUtil
#endif
But when I try to execute snippet above I get
error FS0039: The namespace or module 'InteractiveUtil' is not defined
I also noticed that definition of InteractiveUtil module looks like this:
namespace FSI_0009
module InteractiveUtil = begin
val plotMe : c:FSharp.Charting.ChartTypes.GenericChart -> unit
val logMe : c:string -> unit
end
So FSI_0009 is something fsi created for me.
Any idea how to get around this?
Ok, got it. When I put top level module in the beginning of fsx it worked.
module InteractiveUtil
#time
#r ...
open FSharp.Charting
let plotMe (c : ChartTypes.GenericChart) = c.ShowChart() |> ignore
let logMe (c : string) = c |> printfn "%s"
I would have deleted the question but since I already got one vote up it seems like someone else is interested in solution.
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