Reputation: 1834
I have been trying to migrate a codebase from OCaml 4.04 to OCaml 4.10. I have been running into a recurring error in which when I compare values that are not integers, I get a type error:
if (total < current) then (...)
90 | if (total < current) then (...)
^^^^^
Error: This expression has type float but an expression was expected of type
int
But replacing it with if Float.(total < current)
fixes the issue. Am I doing something wrong, or is it that comparisons in OCaml are no longer polymorphic?
Upvotes: 2
Views: 108
Reputation: 1834
It appears that the change in behavior is due to my use of Jane Street Core. OCaml operators are still polymorphic but using Core forces you to use explicitly typed comparisons.
https://discuss.ocaml.org/t/removing-polymorphic-compare-from-core/2994
Upvotes: 2