In a Visual Studio project for an F# library I have defined a function as
let inline Estimate (s : ^a seq) (f : float) (w : int) : float * float = ..
The type of Estimate
is
val Estimate : s:seq<'a> -> f:float -> w:int -> float*float
Calling Estimate
from a script within that project works as expected.
Now if I compile the project with the --standalone
switch and reference the output DLL from another project, Estimate
is shown to be
Estimate<'a,'a>(s: Collections.Generic.IEnumerabls<'a>, f: float, w:int) : float*float
i.e. it some reason now takes tuple arguments. Thus the following does not work
let q, p = EstimationQuality.Estimate x f 1 // This value is not a function and cannot be applied
but calling it with tuple parameters works fine
let q, p = EstimationQuality.Estimate (x, f, 1) // No problem.
What's wrong here? Is it a bug in the compiler?
EDIT:
Digging a little deeper, it appears that the problem is linked with the use of LanguagePrimitives.GenericZero
.
While the problem actually compiles with the tuple parameter call, i get a runtime error when Estimate
is called.
An unhandled exception of type 'System.TypeInitializationException' occurred in LibraryTest.dll
Additional information: The type initializer for 'GenericZeroDynamicImplTable`1' threw an exception.