Without that, you lose out massively on readability and error message quality.
In Sail, I have IDE type inlays working but it barely helps with reachability because half the types are inferred as generic.
On the other hand the OCaml/interface files approach is superior when you want to read documentation w/o implementation, but in practice using odoc is superior because you get hyperlinks.
In 10 years of using OCaml, I think everytime I interacted with mli I'd rather the author annotated types at the definition site.
BTW I am not sure why you would want to hide the types, I find them always useful.
Other languages (I am familiar with Rust and Python) also have documentation systems that only show you public methods (and functions, types, etc.), and I find them equally useful as odoc. They just take the visibility information from inline annotations (which are enforced by the compiler, in the case of Rust) instead of a separate file.
Agreed. The same criticism can be levelled at C and C++ with header and implementation files.
> So when you make a mistake, you’re still giving constraints to the inference engine. Erroneous type inferences propagate in every direction. Error messages appear hundreds of lines of code away from their origin.
Rust gets this right: it has type inference, but only within the function body. Most of your code is free of annotation cruft, but interfaces are strongly specified and errors can only propagate a certain distance.