On 23 Jun 2013, at 10:13, "Damien Guichard" > wrote: > a) Is there a way to do it where you can end up with type elt = A | B (I think the answer is no?) > b) Is there a syntactically lighter way to write the module definition? My own quick & dirty hack : module FlagSet = Set.Make(struct type t = [`A | `B] let compare = compare end) Sadly not - the values are in use with C bindings and polymorphic variants would rather defeat the point of what I'm doing! What would be nice would be an equivalent 'immediate' syntax for variant types - but its only use would be this context, I expect! David - damien I couldn't think of a better way to describe what I'm trying to do, so forgive the possibly strange subject! In: module IntSet = Set.Make(struct type t = int let compare = compare end) the resulting signature is: sig type elt = int type t ... but in: module FlagSet = Set.Make(struct type t = A | B let compare = compare end) the resulting signature is: sig type elt type t ... i.e. the constructors are hidden (I can see why, but presumably it is a special case in the type checker?) and the module is essentially useless. I don't want to define the type external to the module - the idea is that I'd be able to write Flag1Set.add Flag1Set.CommonFlag Flag1Set.empty and Flag2Set.add Flag2Set.CommonFlag Flag2Set.empty, etc. I can work around this by writing: module FlagSet = struct type flag = A | B include Set.Make(struct type t = flag let compare = compare end) end where the resulting signature is: sig type flag = A | B type elt = flag type t ... but I'm wondering: a) Is there a way to do it where you can end up with type elt = A | B (I think the answer is no?) b) Is there a syntactically lighter way to write the module definition? David