Is there a reason why I can use a generic function with different type arguments when I pass it as a local value, but not when it is passed as a parameter? For instance:
let f = id let g (x,y) = (fx, fy) g ( 1, '2')
works fine, but if I try to pass a function as a parameter
let gf (x,y) = (fx, fy) g id ( 1, '2')
it fails because it accepts version f <int> and it tries to apply it twice.
I found a workaround, but it forces me to write the function that I pass twice:
let g f1 f2 (x,y) = (f1 x, f2 y) g id id ( 1, '2')
This is the second time I am facing this problem.
Why does it behave this way, should it not be the same if the function is a local value or if it is passed as a parameter?
Is there a way to do this without duplicating a function?
Hacking, perhaps using explicit type restrictions, inline magic, quotes?