How can I define a recursive Base.Set type?

This helps a lot. I happen to face the same problems (and I am new to Base).

May I ask how to use deriving sexp_of in this example? It seems I cannot simply put this after the definition of type t.

Edit:

I still don’t figure out how to add deriving sexp_of on this code. But I later found RWO gives an example on creating a new set without mentioning comparator_witness

type string_int_map =
  int Map.M(String).t
[@@deriving sexp]
;;
type string_int_map = int Base.Map.M(Base.String).t
val string_int_map_of_sexp : Sexp.t -> string_int_map = 
val sexp_of_string_int_map : string_int_map -> Sexp.t =

This idea works for my own code.