为什么不#load工作
我已经在相同的文件夹和相关文件夹中尝试了它,如下所示
我错过了什么?
run.fsx是
#load "../shared/shared.fsx"
let key = "MyKey"
let Run(message: string, log: TraceWriter, result: byref<string>) =
result <- doItAll message key
log.Info(sprintf "F# results: %s" result)
Run Code Online (Sandbox Code Playgroud)
shared.fsx是
let doItAll message key = key + " has handled " + message
Run Code Online (Sandbox Code Playgroud)
错误是
run.fsx(x,y): error FS39: The value or constructor 'doItAll' is not defined
Run Code Online (Sandbox Code Playgroud) 我想将结果发送到将内容输出到控制台/日志的单个方法
我曾希望检测结果是否包含 IEnumerable 并遍历该集合以获取结果。
这无法识别 seq 并简单地将其标识为Other Object.
对不起,冗长。
let rec LogResultGeneric (logInfo: string -> unit, logError: string -> unit) (result: Result<_, _>) =
let innerSelect (item: _) =
match item |> box with
| :? Result<_, _> as res ->
"RESULT" |> logInfo
res |> LogResultGeneric(logInfo, logError)
| _ ->
"VALUE" |> logInfo
item |> LogValueGeneric logInfo
"DISPLAY OUTCOME : " + result.ToString() |> logInfo
match result with
| Error msg ->
"ERROR RESULT" |> logError
match …Run Code Online (Sandbox Code Playgroud)