Existential quantification

George Russell ger@tzi.de
Wed, 21 Feb 2001 21:12:01 +0100

Tom Pledger wrote:
> George Russell writes:
>  | Excuse me, but is it a bug or a feature that Hugs (98-Feb2001), with
>  | the -98 option, rejects:
>  |
>  | data G b = forall a . H a b =>  G a b
>  |
>  | class H a b where
>  |
>  | with "Variable "b" in constraint is not locally bound"?
> What do you intend for the type of G?
>     G :: H a b => a -> b -> G b
> ...but where does the "forall a" go?
G has existential type, something like 
   (exists b . H a b => a -> b) -> G b
Isn't this what existential type constructors are for?  Of course you can't write
"exists" in Hugs, because existential type constructors are supposed to do roughly
the same job (with better error messages). 
> Apart from the lack of a functional dependency in the H decl, this
> looks like a recent thread on the main Haskell list, subject "Fundeps
> and quantified constructors".
The thread doesn't appear to answer my question, namely is this a bug or a feature
in Hugs?
> The original question:
>     http://www.mail-archive.com/haskell@haskell.org/msg07982.html
> The realisation that GHC permitted it:
>     http://www.mail-archive.com/haskell@haskell.org/msg08036.html
I know GHC permits it.  The problem arose when I was trying to port
some GHC code to Hugs.