[Haskell-cafe] A Question of Restriction

Brian Troutwine goofyheadedpunk at gmail.com
Mon Jul 27 00:01:22 EDT 2009

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 = One | Two | Three | Four
   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?


More information about the Haskell-Cafe mailing list