1 {-# OPTIONS -fglasgow-exts #-}
3 -- !!! Existential data tyes
4 -- Hugs didn't like this one
6 module Main (main) where
9 class MyClass a b where
12 data Special = forall b. (MyClass Int b)=> MkSpecial b
13 data General a = forall b. (MyClass a b)=> MkGeneral b
15 instance MyClass Int Bool where
20 xs = [MkGeneral True, MkGeneral False]
22 main = print [foo (3::Int) x | MkGeneral x <- xs]
23 -- Without the (::Int) part we get an
24 -- incomprehensible error message :-(