The general rule of thumb when interoping with C# is that methods in C# are tupled in F#... except when you try to create a new System.Func.
Example:
open System
// Error:
// [FS0001] Type mismatch. Expecting a
// 'string -> int -> string * int'
// but given a
// ''a * 'b -> 'a * 'b'
//The type 'string' does not match the type ''a * 'b'
let func : Func<string, int, string*int> =
let f (s,i) = (s,i)
Func<string, int, string*int>(f)
// Ok
let func : Func<string, int, string*int> =
let f s i = (s,i)
Func<string, int, string*int>(f)
In the spirit of the "elmish" error message improvements a few months ago, it would be awesome if the compiler could detect this case and give explicit instructions how to resolve this.
The general rule of thumb when interoping with C# is that methods in C# are tupled in F#... except when you try to create a new System.Func.
Example:
In the spirit of the "elmish" error message improvements a few months ago, it would be awesome if the compiler could detect this case and give explicit instructions how to resolve this.