ocaml-containers icon indicating copy to clipboard operation
ocaml-containers copied to clipboard

Default implementations for Map.S, Set.S

Open francoisthire opened this issue 9 months ago • 1 comments

I was wondering why Containers does not provide a default implementation for Map.S or Set.S in modules for List, String, etc... Most of the time the default comparison function is used and this could avoid the to duplicate the functor instantiation.

For example, it would be nice to write

type 'a t = 'a String.Map.t

or

type t = Int.Set.t

francoisthire avatar Feb 22 '25 10:02 francoisthire

It's just a bit hard to know where to stop :-). In my projects I tend to have a common_.ml module with the functor instantiations I need, opened in the rest of the files.

I suppose we could have this for Set/Map/Tbl instantiated on int/string, and nothing more.

c-cube avatar Feb 25 '25 15:02 c-cube