data A=A data B=B data AB=A|B
Which makes a sum type AB from A and B.
but the last line induces a compile error \"multiple declarations of
Because the type of the value created using data constructor A or B will be ambiguous. When I have a = B for instance, what is the type of a? It is A or AB?
A
B
a = B
a
AB
You should consider using different data constructor as follows:
data A = MkA data B = MkB data AB = A A | B B