[Haskell-cafe] Re: A question about functional dependencies and
existential quantification
Felipe Almeida Lessa
felipe.lessa at gmail.com
Tue Mar 27 16:35:28 EDT 2007
On 3/27/07, Jean-Marie Gaillourdet <jmg at informatik.uni-kl.de> wrote:
> > I concur. The class declares T as being a ternary relation such that
> > the following holds
> > forall r p p' s s'. T(r,p,s) && T(r,p',s') -> s = s'
> > Now, the instance `T root (Any root) sel' is satisfied when
> > root=Int, sel = Bool and when root=Int, sel = Int. Does it not? That
> > falsifies the above proposition. In other words, the instance T is not
> > functional with respect to the first and the third arguments.
> >
> > That is not surprising. What is surprising is why GHC 6.6 accepts such
> > an instance?
>
> GHC 6.6 does not accept such instances. Add the following code to the
> module TestCase
>
> > instance T Int Int Int
> > instance T Int Int Bool
I'm not an expert as well, but I think oleg was actually talking about
> instance T Int (Any Int) Int
> instance T Int (Any Int) Bool
which also fails (on GHC 6.6) with:
Functional dependencies conflict between instance declarations:
instance T Int (Any Int) Int -- Defined at ...
instance T Int (Any Int) Bool -- Defined at ...
although just
> instance T root (Any root) sel
is accepted.
--
Felipe.
More information about the Haskell-Cafe
mailing list