Recursive Variants of Set

"Jacques du Preez [email protected] [ocaml_beginners]" <[email protected]>
Newsgroups gmane.comp.lang.ocaml.beginners
Message-ID <CAMBKu=en8FaqHM63gY7_9GECM7HDHosUZ3s1ANJczH7y70p2Xg@mail.gmail.com>
Hi,

Please consider my common.mli:

type id = | Id of Common.Id_set.t
          | Common of string
  | ObjStore of string

module Id_set : (Set.S with type elt = id)

Now my common.ml:

type id = | Id of Common.Id_set.t
          | Common of string
  | ObjStore of string

module Id_set = Set.Make(
    struct
      type t = id
      let compare = Pervasives.compare
    end)

The above gives an circular build error. If I change Common.Id_set.t to
Id_set.t, then I get an unbound module error - I'm assuming this is because
the Id_set module declaration is after the variant declaration.

What I'd like to know is, how would I change my Id variant to be of type
"id set"? Is this possible? The problem here is that Id_set depends on
variant id, and vice versa. How to solve this?

Thanks,

==============================
Jacques du Preez

Web: OpenLandscape.net
Twitter: @jacquesdp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.