> Do you have any reason not to do the above? Yes, the subset types that I wish to define are not clean partitions, though my example does suggest this. Let's say that the definition of Foo is now
data Foo = One | Two | Three | Four | Five | Six while Odd and Even remain the same. I would further like to define Triangular, which I will do incorrectly for consistency. data Triangular = One | Three | Six I could not accommodate this definition using your scheme, correct? Thanks, Brian On Sun, Jul 26, 2009 at 9:14 PM, Felipe Lessa<felipe.le...@gmail.com> wrote: > On Sun, Jul 26, 2009 at 09:01:22PM -0700, Brian Troutwine wrote: >> Hello all. >> >> I would like to define a data type that is the super-set of several >> types and then each of the proper subset types. For example: >> > > data Foo = O !Odd | E !Even > >> data Odd = One | Three >> data Even = Two | Four >> >> This, of course, does not work. It seems that such a thing should >> possible to express entirely in the type system, but I cannot think of >> how. Would someone be so kind as to explain how this sort of thing can >> be accomplished? > > Do you have any reason not to do the above? > > -- > Felipe. > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe