我有一个fsx文件,用于我的项目的交互开发。它预加载所有的dll,另外,我还想模拟几个在FSI世界中行为不同的函数。
在fsx中,我有以下代码:
// #r needed dlls
open FSharp.Charting
module InteractiveUtil =
let plotMe (c : ChartTypes.GenericChart) = c.ShowChart() |> ignore
let logMe (c : string) = c |> printfn "%s"现在,在.fs文件中,我想使用以下内容:
#if INTERACTIVE
#load "LiveInvestigationPreload.fsx"
open InteractiveUtil
#endif但是当我试图执行上面的片段时
错误FS0039:未定义命名空间或模块“InteractiveUtil”
我还注意到,InteractiveUtil模块的定义如下所示:
namespace FSI_0009
module InteractiveUtil = begin
val plotMe : c:FSharp.Charting.ChartTypes.GenericChart -> unit
val logMe : c:string -> unit
end所以FSI_0009是fsi为我创造的东西。
知道怎么绕过这件事吗?
发布于 2014-12-10 19:34:56
好了,明白了。当我将顶级模块放在fsx的开头时,它起了作用。
module InteractiveUtil
#time
#r ...
open FSharp.Charting
let plotMe (c : ChartTypes.GenericChart) = c.ShowChart() |> ignore
let logMe (c : string) = c |> printfn "%s"我本来会删除这个问题,但既然我已经投了一票,似乎有人对解决办法感兴趣。
https://stackoverflow.com/questions/27409266
复制相似问题