What is the Set.empty (module String)

this is code

List.fold messages ~init:([], Set.empty (module String)) ~f:...

i don‘t understand why is it followed by an (module String)

May be a case of the blind leading the blind here, but I think its a Functor (function on a module) Functors · OCaml Tutorials

You are using the base library which is defining its own Set module: Set (base.Base.Set) . This version of Set requires all set creation function to take a first class module argument which defines the type of the set elements and the related comparison function. In other words,

Set.empty (module String)

defines an empty set of strings sorted by the String.compare function.

2 Likes