[Haskell-cafe] Re: A question about functional dependencies and existential

Jean-Marie Gaillourdet jmg at informatik.uni-kl.de
Wed Mar 28 03:26:49 EDT 2007

Hi Oleg and others,

oleg at pobox.com wrote:
> Jean-Marie Gaillourdet wrote:
>>> class T root pos sel | pos -> root, root -> sel where
>>>    f :: pos -> sel -> Bool
>>> instance T root (Any root) sel
>> If that is correct, I don't understand why this instance should be to
>> general, as every instantiation of "root" exactly determines the
>> corresponding instantiation of "Any root".
> The class T has two functional dependencies: pos -> root and
> root->sel. I believe you are talking about the former whereas my
> previous message was talking about the latter.

But the same applies to the second functional dependency and the type
variable sel. Every instantiation of root determines the instantiation
of sel. And that forbids instance T Int (Any Int) Bool and instance T
Int (Any Int) Int inside the same scope, doesn't it?

At least, that is what I would like to express by those two fundeps.

More information about the Haskell-Cafe mailing list