Keep in mind that, since you are calling a static method, we're not talking about partial application, but overload resolution. The crucial difference is that partial application requires a function with curried arguments and an arity of at least two, while overload resolution will be performed by the compiler on methods which take tupled arguments.
Here's a simple example of partial application of the F# addition operator, reducing the arity (number of curried arguments) from two to one:
let add = (+)
// val add : (int -> int -> int)
let add1 = (+) 1
// val add1 : (int -> int)
The TryParse
method has two overloads with two and four tupled arguments, respectively.
public static bool TryParse(string s, out int result)
public static bool TryParse(string s, System.Globalization.NumberStyles style, System.IFormatProvider provider, out int result)
For the out
parameter, a special syntactic conversion will be performed by the F# compiler, so that you actually need to provide either one or three tupled arguments for the overload to be successfully resolved. By specifying the first, string input argument, your definition will work as expected:
open System
open System.Globalization
let tryParseAnyNumberStyle s =
Int32.TryParse(s,
style=NumberStyles.Any,
provider=CultureInfo.CurrentCulture )
// val tryParseAnyNumberStyle : s:string -> bool * int