Given the following:
open System.Linq
let seqA = { 1..10 }
this works:
seqA.All (fun n -> n > 0)
However this doesn't:
let abc = fun n -> n > 0
seqA.All (abc)
Why does F# offer implicit conversion from lambda expressions to Func
s but not from functions? Pointers to the documentation where I can read up on what's going on here are welcome. :-)
This is covered in the (rather involved) section of the spec on Method Resolution and again in Type-directed Conversions at Member Invocations. Quoting from the latter:
It seems to suggest this conversion would be applied to any function value, but observation suggests it's applied only to anonymous functions.