I started this new question as it was a continuation of my previous question.
If I have two data types that consist of similar constructors:
data A = X | Y | Z data B = X | Y
I cannot somehow imagine this as:
data A = C | Z data B = C data C = X | Y
if you can see what I'm doing - I'm trying to group X | Y into one data type, which can then be used by several other data types. I can not get the compiler to allow this, or if it is, I can not match the pattern with X or Y, only C ??
I get an error that C has been declared several times.
I thought I could use types, but they do not allow multiple vices.
EDIT
Even if I declare a long path (e.g. below), it still will not compile and says that X and Y have several declarations:
data A = X | Y | Z data B = X | Y
Lethi source share