On Thu, Mar 21, 2013 at 06:18:46PM +0530, C K Kashyap wrote:
> 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

If C3 should only be able to hold a C2 Char, then why have it hold a T
at all?  i.e. why not

  data T = C1 Int | C2 Char | C3 Char

but I suppose your real problem is probably more complicated, in which
case I would recommend using a GADT as others have suggested.

-Brent

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to