#714: Inconsistency between handling functional dependencies in class and
signature constraints
-------------------------------------+--------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: simonpj
Type: bug | Status: new
Priority: low | Milestone: 6.10 branch
Component: Compiler (Type checker) | Version: 6.5
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
-------------------------------------+--------------------------------------
Comment (by simonpj):
An instance declaration is a bit like a function type signature, but a
class declaration is different. It ''looks'' a bit like a signature, but
it is used the other way round. Consider
{{{
class C a => D a where ...
}}}
This means that "we can get a dictionary for (C a) from a dictionary for
(D a)". On the other hand
{{{
instance C a => D [a] where ...
}}}
means "we can get a dictionary for (D [a]) from a dictionary for (C a)".
Notice the reversal. So (reversing my previous comment above) I don't
think it's inconsistent to have different rules for class and instance
decls.
So I think Manuel is right here. (And the user manual could be improved.)
I don't think it's impossible to make sense of
{{{
class C a b => D a
}}}
if (C a b) has a functional dependency. But if so, I'd prefer to write
{{{
class C a (F b) => D a
}}}
Let's see if there are examples that give convincing evidence to the
contrary. Perhaps these exist -- Claus describes the problem as acute.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/714#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs