
On 14 December 2010 21:44, Russ Abbott
What's confusing is that
data AorB = A | B
compiles with error. That raises the question of what it really means!
You have to distinguish between type and value constructors. On the left hand side of a data declaration you have a type constructor (AorB) and possibly some type variables. On the right hand side you have value constructors followed by their arguments (types or type variables). E.g.: data TypeConstr a b c = ValueConstr1 a b | ValueConstr2 c | ValueConstr3 Int But in your example A and B were already declared as type constructors, so they can't be used again as value constructors. That's why you get an error. If you remove data A = ... and data B = ... then data AorB = A | B compiles.