Let's say I have these datatypes:
data A = A1 | A2 | A3 | A4 | A5 deriving (Enum)
data B = B1 | B2 | B3 | B4 deriving (Enum)
data C = C {a :: A, b :: B}
And then I want to create a list of [C], that contains all possible variants of combinations of As and Bs, with As at least A3. I thought it would work if I write it like this:
myListC = [(C A3 B1) .. (C A5 B4)]
and Haskell would automatically enumerate all of them. But, obviously, no. Deriving Enum in data C definition is also impossible.
I understand that in this case, it isn't that hard to do it manually, but what if I have more variants in my data C? Is there some way to do it quickly? Would appreciate your help!