I have a sequence of FileInfo, but I only care about their string names, so I want a sequence of string. At first I tried something like this:
Seq.map (fun fi -> fi.Name) fis
But for some reason, F#'s type inference isn't good enough to allow this, and made me explicitly give a type to "fi":
Seq.map (fun (fi : FileInfo) -> fi.Name) fis
Why is this annotation required? If it is known that fis : seq<FileInfo>
and that Seq.map : ('a -> 'b) -> seq<'a> -> seq<'b>
, then shouldn't it infer that the type of the lambda expression is FileInfo -> 'b
, and then, from fi.Name : string
, further infer that its type is FileInfo -> string
?