I’m looking for an elegant way to compose enums that have repeat values. We can do this with error unions quite easily:
const A = error { a, b, c };
const B = error { x };
const C = error { y };
// we don't have to repeat a, b, c
const MyError1 = A || B;
const MyError2 = A || C;
But enums are quite a bit different here. There isn’t a global enum set we can coerce to.
If the enums are plain, you could just keep the shared names in a tuple and the unique names in a tuple and then contruct a enum type from that using @Type.
But this doesn’t work if you want your enum to have methods or decls directly.
And the shared names are only related via their name.