It seems reasonable to me, and GHC is happy. 
Here's a working example:

Simon


class MyClass a b where
        foo :: a -> b -> Int

data Special = forall b. (MyClass Int b)=> MkSpecial b
data General a = forall b. (MyClass a b)=> MkGeneral b

instance MyClass Int Bool where
   foo x False = -x
   foo x True  = x

xs :: [General Int]
xs = [MkGeneral True, MkGeneral False]

main = print [foo (3::Int) x | MkGeneral x <- xs]



| -----Original Message-----
| From: Ashley Yakeley [mailto:[EMAIL PROTECTED]]
| Sent: 29 March 2001 10:47
| To: Haskell List
| Subject: Parameterising Class Constraints in Existential Types
| 
| 
| Is this valid (extended) Haskell?
| 
| --
| class MyClass a b where
|       foo :: a -> b -> Int
| 
| data Special = forall b. (MyClass Int b)=> MkSpecial b
| data General a = forall b. (MyClass a b)=> MkGeneral b
| --
| 
| Hugs complains about the 'General' line but has no problem with the 
| 'Special' line...
| 
| -- 
| Ashley Yakeley, Seattle WA
| 
| 
| _______________________________________________
| Haskell mailing list
| [EMAIL PROTECTED]
| http://www.haskell.org/mailman/listinfo/haskell
| 

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to