Fundeps and quantified constructors

nubie nubie anatoli@yahoo.com
Fri, 2 Feb 2001 22:49:19 -0800 (PST)


--- Tom Pledger <Tom.Pledger@peace.com> wrote:
> That line of reasoning establishes that e is constrained on the right
> hand side of the "=".  However, it's still bound (by an implicit
> "forall e") on the left hand side of the "=".  The problem is that e
> can leak details about c to parts of the program outside the "forall
> c".  It's still a problem if you remove the "| c -> e" fundep.

(1) How can it leak?
(2) Why is this a problem?

> A more common use of a "Collection c e | c -> e" class is:
> 
>     data SomeCollection e = --some data structure involving e
> 
>     instance SomeContext e => Collection (SomeCollection e) e where
>         --implementations of empty and put, for the aforementioned
>         --data structure, and entitled to assume SomeContext
> 
> Is that collection type polymorphic enough for your purposes?

You mean, like

  instance Collection [a] a where
    empty = []
    put = flip (:)
?

Yes, of course this usage is intended. But then I want a type
that can hold any collection of a, for given a. Collection
is a class, not a type, and I need a type.

--
anatoli

__________________________________________________
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/