Re:Hindley-Milner Type Inference (2012)
by xvilka on Friday July 10, 2020 @10:47PM
(#23799031)
I once wondered about subtyping[1] too. Looks like there's a possible solution - MLsub[2][3]. But it will require significant amount of work to modify OCaml inference engine to work that way. For now I just use functors for types with the shared fields. It doesn't add too much lines of code either.
[1] https://discuss.ocaml.org/t/function-argument-polymorphism/3...
[2] https://www.cl.cam.ac.uk/~sd601/papers/mlsub-preprint.pdf
[3] https://github.com/stedolan/mlsub