
21 Mar
2013
21 Mar
'13
8:48 a.m.
Hi, I have a situation where I need to define a data type T such that data T = C1 Int | C2 Char | C3 T However, I want to enforce a constraint that C3 only allows (C2 Char) and not (C1 Int). That is x = C3 (C1 10) -- should not compile - but my above definition will let it compile I was thinking of this - data C1 = C1 Int data C2 = C2 Char data T = TC1 C1 | TC1 C2 | TC3 C2 Is there a better way to do it? Regards, Kashyap