existentials

Ross Paterson <[email protected]> Sat, 29 Oct 2005 21:35:27 +0100
Newsgroups gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
Iavor Diatchki writes:
> It appears that Hugs (20050909) does not deal correctly with
> existentials and multi-parameter type classes:
> 
> > class C a b where
> >   f              :: a -> b
> >
> > data T b          = forall a. C a b => T a
> >
> > test (T a)        = f a
> 
> Hugs accepts this program, inferring the following type for 'test':
>   Main> :t test
>   test :: C _5 a => T b -> a
>   Main> :t test (undefined :: T Char)
>   test undefined :: C (T Char) a => a

The same bug shows without multi-parameter type classes: Hugs accepts

	data T = forall a. C a

        test (C x) = toInteger x

Now fixed in CVS.