How to use non-basic type as a field in records

Hi, I am trying to build a Hashtbl from int to block and its specification is shown below

type block = {
in_ : int Set
;out_: int Set

However, I noticed that Set is not one of basic type in OCaml, so it contradicts record signature below.

type <record-name> =
{ <field> : <type>;
  <field> : <type>;

So, is there any way I can use Set as a field in records?

Indeed, this kind of declaration is more like object-oriented style, but considering my block may have many fields to store, it seems dump them into one record is a natural way.

Which Set are you using? If it’s the standard library’s set, then you would actually create a module: module IntSet = Set.Make(Int). Then you can use IntSet.t as a type:

type block = { in_ : IntSet.t; out : IntSet.t }

Thank you! This is exactly what I want!

Sorry to bother again, but how can I declare this type in a mli file?
I am facing a error as below

(module Set.Make)
Functor building an implementation of the set structure given a totally ordered type.
Syntax error merlin

module IntSet : Set.S with type elt = int

See the module documentation of the Set module for details.