请参阅以下代码.
let x = Seq.head [1.0; 2.0] // This is ok.
type Func<'T> = { f: seq<'T> -> 'T }
let func = { f = Seq.head }
// Compilation error: This expression was expected to have type seq<obj> but here has type 'a list
let y = func.f [1.0; 2.0]
let z = func.f ([1.0; 2.0] |> List.toSeq) // This is ok.
Run Code Online (Sandbox Code Playgroud)
我不明白为什么Seq.head和fund.f的行为在这里有所不同.它对我来说看起来像编译器错误.但是,如果这是设计的,有人可以帮我解释一下吗?非常感谢!