This was reported by @ephja on Gitter. Fable generates a curried function if ResizeArray.Sort is used with a custom comparer function.
let ns = ResizeArray<int> ()
ns.Sort compare
For the Sort method, Fable generates this:
ns.sort(function ($var1) {
return function ($var2) {
return (0, _Util.comparePrimitives)($var1, $var2);
};
});
But this doesn't work at runtime (no runtime error, though). The call should rather look like this:
ns.sort(_Util.comparePrimitives);
You can work around this by using another function or with an extension method:
open Fable.Core.JsInterop
type System.Collections.Generic.List<'a> with
member inline this.sort (f : 'a -> 'a -> int) : unit =
!! (this?sort $ f)
ns.sort compare
_BTW, I love the fact that this works_ 馃槃
dotnet fable --version): 1.3.14Still reproduces with v2.
Thanks @inosik! You made me realize I've been doing it wrong all this time with to get the signature of delegate types coming from the BCL. There are a few more edge cases to solve but the general ones (including the one reported in this issue) will be fixes in the next release :+1:
Most helpful comment
Still reproduces with v2.