Ok I am very new to F# so maybe this has been well explained in the textbooks but why F# function with curried arguments cannot have optional parameter. For instance function Fun1
doesn't compile whereas the other two functions compile fine. I want to know what's reason for having this constraint on optional parameter? And is there, if any, way to get around this constraint?
type TestOptionalParameter =
member x.Fun1 (a: int) (?b : bool) =
if defaultArg b true then a else 2 * a
member x.Fun2 (?b : bool) =
if defaultArg b true then "yes" else "no"
member x.Fun3 (a: int, ?b : bool) =
if defaultArg b true then a else 2 * a