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"? PS - please CC me with replies as I don't normally subscribe to this list.
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? 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 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 Regards, Tom
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.
George Russell wrote:
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"?
As far as I can understand the restriction is there on purpose, although that purpose might just be to avoid trouble with the particular implementation of local existential quantification that comes with Hugs. In principle there shouldn't be any problem removing this restriction, however, I'll have to look at the code more carefully before I can make any promise about doing so in a future release. -- Johan
participants (3)
-
George Russell -
Johan Nordlander -
Tom Pledger