相关疑难解决方法(0)

F#编译错误:意外的类型应用程序

在F#中,给出以下类:

type Foo() =
    member this.Bar<'t> (arg0:string) = ignore()
Run Code Online (Sandbox Code Playgroud)

为什么以下编译:

let f = new Foo()
f.Bar<Int32> "string"
Run Code Online (Sandbox Code Playgroud)

虽然以下内容不会编译:

let f = new Foo()
"string" |> f.Bar<Int32> //The compiler returns the error: "Unexpected type application"
Run Code Online (Sandbox Code Playgroud)

generics f# pipelining

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

标签 统计

f# ×1

generics ×1

pipelining ×1