[project @ 2001-05-03 08:18:35 by simonpj]
[ghc-hetmet.git] / ghc / tests / typecheck / should_run / tcrun011.hs
1 {-# OPTIONS -fglasgow-exts #-}
2
3 -- !!! Existential data tyes
4 -- Hugs didn't like this one
5
6 module Main (main) where
7
8
9 class MyClass a b where
10         foo :: a -> b -> Int
11
12 data Special = forall b. (MyClass Int b)=> MkSpecial b
13 data General a = forall b. (MyClass a b)=> MkGeneral b
14
15 instance MyClass Int Bool where
16    foo x False = -x
17    foo x True  = x
18
19 xs :: [General Int]
20 xs = [MkGeneral True, MkGeneral False]
21
22 main = print [foo (3::Int) x | MkGeneral x <- xs]
23         -- Without the (::Int) part we get an 
24         -- incomprehensible error message :-(