小编Dav*_*peš的帖子

#load无法加载共享.fsx

为什么不#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)

f# azure azure-functions

5
推荐指数
1
解决办法
60
查看次数

f# 模式匹配序列 :? seq&lt;_&gt; (IEnumerable)

我想将结果发送到将内容输出到控制台/日志的单个方法

我曾希望检测结果是否包含 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)

generics f# types pattern-matching

1
推荐指数
1
解决办法
118
查看次数

标签 统计

f# ×2

azure ×1

azure-functions ×1

generics ×1

pattern-matching ×1

types ×1