Based on this kvb answer, this code compiles (F # 4) and runs:
type Untupler = abstract Apply : 'u * 'u -> 'u let myotherFun arg1 arg2 = printfn "myotherFun result is : %A %A" arg1 arg2 let myFunction tup1 tup2 (i:Untupler) = myotherFun (i.Apply tup1) (i.Apply tup2) let reskvb = myFunction (1,2) ("Hello","World") { new Untupler with member __.Apply (x,y) = snd (x,y) }
But if the last line is replaced with the original answer:
let reskvb = myFunction (1,2) ("Hello","World") { new Untupler with member __.Apply x = fst x }
then the compiler complains about error FS0768: The "Apply" participant does not accept the correct number of arguments, 2 arguments are expected
I do not understand why the compiler does not seem to conclude that x is indeed a tuple. Or is there another question that I am missing? thanks.
source share