Jane Street's '*_intf.ml' usage

I’ve been looking at some of Jane Street’s open source libraries and came across the use of [module]_intf.ml files in combination with [module].ml and [module].mli files. An example of this is applicative, defined in Base

Aside from eliminating the need to write signatures out in both implementation and interfaces files, what are the advantages of this approach?

Thanks,

Michael

2 Likes

That’s the main one. This is especially useful when you’re using functors, by the way, since you’d otherwise write out the signatures possibly even more than twice. You probably won’t see this much, if at all, with modules that don’t define functors.

1 Like

Thank you; I hadn’t picked up on the fact that this was only(?) done where a functor was defined but that does make sense.