datatype A of
MkA of
m1: T1;
m2: T2;
end;
end;
datatype B <: A of
MkB of
MkA;
m3: T3;
m4: T4;
end;
end;
This would give B <: A. (Nothing special with GDS.)
To create a B:
mkB: A -> T3 -> T4 -> B =
fn MkA, m3, m4 => MkB;
Conditions:
Every constructor of B must be a record constructor, and it must mention a record constructor of A.
Multiple inheritance with diamonds
Broken diamond looks like this:
datatype A of
MkA1 of end;
MkA2 of end;
end;
datatype B <: A of
MkB of MkA1 end;
end;
datatype C <: A of
MkC of MkA2 end;
end;
datatype D <: B & C of
MkD of MkB; MkC; end;
end;
Something like:
This would give
B <: A
. (Nothing special with GDS.)To create a
B
:Conditions:
B
must be a record constructor, and it must mention a record constructor ofA
.Multiple inheritance with diamonds
Broken diamond looks like this: