
Hello Bullat,
also, ghc66 adds impredicative polymorphism. how it differs from unqualified existentials?
I have not tried ghc66, but I think one of the things you should be able to do and that is perhaps helpful for understanding existencial is:
myList :: [forall a . Num a => a] myList = [3 :: Int, 4 :: Float, 6 :: Integer]
which in previous versions of GHC would need to be written as:
myList :: [Ex] myList = [Ex (3 ::Int), Ex (4 :: Float), Ex (6 :: Integer)]
I took a look at the documentation and I think I told you the wrong thing here. I think this should be equivallent to:
myList :: [Po] myList = [Po 3, Po 4, Po 6]
which, in this case wouldn't be too useful (would it?). Having structures with polymorphic components is more useful when you have functions. The example they give is:
f :: Maybe (forall a. [a] -> [a]) -> Maybe ([Int], [Char]) f (Just g) = Just (g [3], g "hello") f Nothing = Nothing
However, the following (which would be the right way to express my example) would be handy to have as well:
myList :: [exists a . Num a => a] myList = [3 :: Int, 4 :: Float, 6 :: Integer]
but I don't think this is available in GHC 6.6. Can anyone confirm this? Cheers, Bruno Oliveira