How often should I annotate when it's not required?


I’ve noticed that occasionally I would add a feature somewhere and all of a sudden it would break the type inference in another part of the program unexpectedly. This was pretty obvious since it broke when tweaking the new feature, but it made me wonder… how often should we be annotating types when it’s not required for maintainability of the program? I’m hoping some more seasoned Ocamlers would have experience with how much is ideal?


FYI, I’ve posted this on the OCaml reddit thread and have some interesting feedback for anyone interested:


I usually annotate at module boundaries, for example if another module is going to be using a function. The problem with that is it’s hard to tell what’s “exported” compared to JS-land.


Thanks! I think i’m going to start doing that and also using module interface files as well.