Recursive Variants of Set
| 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