
Arlen Cuss
As Mats pointed out, an existential quantification will let you define your polymorphic element (and to quote Mats):
{-# LANGUAGE ExistentialQuantification #-}
data HeteroElement = forall a. Element a
list = [Element 1, Element 'a', Element True]
The question is, what can you do with this list? You can't "show" it, because there's no requirement on HeteroElement's "a" type of it having a Show instance (adding 'deriving Show' to the data statement will cause an error, as it cannot be done for all 'a'!). You can't find out their types. Indeed, you can't do anything at all with an Element, simply because there's no restriction placed on their value. They could contain anything at all.
This definition is indeed not very useful, but you can have something like the following: class Renderable a class Updatable a data GameObj = forall a. (Renderable a, Updatable a) => GameObj a list :: [GameObj] list = [ GameObj SpaceMarine, GameObj Zombie, GameObj BFG9000 ] Greets, Ertugrul -- nightmare = unsafePerformIO (getWrongWife >>= sex) http://ertes.de/