On Mon, Aug 15, 2011 at 19:35, Hartmut <hartmut0407@googlemail.com> wrote:
data BasicSelect a =  NumberSelect a | StringSelect a
data Num a => NumberSelect a = SelectionNum a
data Show a => StringSelect a = SelectionStr a

This seems a bit confused.  Additionally, the contexts don't do what you intend (they're nearly useless and will probably be removed in a future Haskell revision).

I think what you're reaching for here is a GADT:

> data BasicSelect a where
>   SelectionNum :: Num a => a -> BasicSelect a
>   SelectionStr :: Show a => a -> BasicSelect a

I think you otherwise end up with a typeclass or with existentials; both introduce complexity, and I think the existentials solution still allows anything to be stuffed into it, whereas you want to limit it to SelectionNum or SelectionStr.  (Typeclasses at least require an instance to be defined first; but they don't prohibit people from doing so, if that's what you're after.)

--
brandon s allbery                                      allbery.b@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms