Fundeps and quantified constructors
Fri, 2 Feb 2001 16:06:29 -0800 (PST)
So I want to have a polymorphic Collection type, just because.
> class Collection c e | c -> e where
> empty :: c
> put :: c -> e -> c
> data SomeCollection e = forall c . Collection c e => MakeSomeCollection c
Hugs (February 2000) doesn't like it. It says
Variable "e" in constraint is not locally bound
I feel that e *is* bound, sort of, because c is bound and there's a
fundep c->e. Who's wrong, me or Hugs?
The following things work as expected:
> data IntCollection = forall c . Collection c Int => MakeIntCollection c
> data AnyCollection = forall c e . Collection c e => MakeAnyCollection c
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/