6 ms·
You can get OCaml to behave like 2, but you need eg Generalised Algebraic Datatypes or some magic with modules to do so. See https://blog.janestreet.com/why-ga
by eru 6y ago
You can get OCaml to behave like 2, but you need eg Generalised Algebraic Datatypes or some magic with modules to do so.
See https://blog.janestreet.com/why-gadts-matter-for-performance/ https://blog.janestreet.com/why-gadts-matter-for-performance... and https://blog.janestreet.com/more-expressive-gadt-encodings-via-first-class-modules/ https://blog.janestreet.com/more-expressive-gadt-encodings-v... for why you'd sometimes want the behaviour in 2.
(I do agree, that that behaviour is a bad default.)