It’s a minor thing, but I also am not super-fond of having (sometimes duplicated) modules here and there to hold the results of simple functor applications.
AFAICT, the main approach that happens to address this is used in Jane Street’s libraries, where functors are de-emphasized. Rather, a module bearing type and e.g. comparator implementations is passed by value to “constructors”:
let empty = Set.empty (module String)
let set1 = Set.singleton (module String) "abc"
Note though that this approach does carry a performance penalty, as explored here: Functorial vs "comparator" container interfaces?
FWIW, I would personally appreciate something like Set(String).empty
, which could probably be made as efficient as the current functor approach.