Closed
Description
Currently, the compare function for Array.sort
/Array.sortInPlace
is typed as
('a, 'a) => int
I do realize that this is also the signature used in OCaml's compare functions, but I wonder if the return type shouldn't be float
instead for the ReScript/JS world. Looking at the MDN documentation for Array.sort, there is no need for the return type to be an integer, it is just about > 0, < 0 or === 0.
Using float
instead of int
would be more generic and allow us e.g. to use (a, b) => a -. b
as a compare function for floats.
What do you think?
Metadata
Metadata
Assignees
Labels
No labels