
8 Apr
2005
8 Apr
'05
4:31 p.m.
Hi everyone. Being new to Haskell I wonder how I can make a list contain different types but all implementing the same class, like this: data X = X data Y = Y class Z a where f :: a -> Int instance Z X where f x = 0 instance Z Y where f y = 1 test1 :: Z a => [a] test1 = [X,Y] test2 = map f test1 Is it possible to make this work? /Bo Herlin