Thu, 21 Dec 2000 00:59:29 -0800, Jeffrey R. Lewis <[EMAIL PROTECTED]> pisze:

> >         class HasFoo a b | a -> b where

> >         f :: HasFoo Int b => Int -> b
> >         f x = foo x

> This is the step where the reasoning goes wrong.  The functional
> dependency tells you that `b' isn't really a free variable, since
> it is dependent on `a'.  If you substitute for `a', you can't expect
> `b' to remain unconstrained.

It's not unconstrained: the constraint is "HasFoo Int b", as written.
IMHO it should not matter that the constraint fully determines b.

> Asimilar situation arises if you try to declare an instance `HasFoo
> Int b', but in this case, hugs complains that the instance is more
> general than the dependency allows.

ghc does not complain. How would I express "the instance can be chosen
basing on 'a' alone, and the instance found will tell what constraints
are on 'b'"?

Aren't fundeps a too general mechanism which is not able to express
simpler statements? :-(

-- 
 __("<  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZAST�PCZA
QRCZAK


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to