[GHC] #1241: Functional dependencies not checked.
GHC
trac at galois.com
Thu Mar 29 11:46:10 EDT 2007
#1241: Functional dependencies not checked.
-------------------------------------+--------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone: _|_
Component: Compiler (Type checker) | Version: 6.6
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
-------------------------------------+--------------------------------------
Comment (by claus):
actually, while FDs are used to instantiate type variables, that never
seems to happen for explicit type declarations. and the type parameters of
an instance head become part of the explicit type declarations for the
class methods.
also, even after we filter out the instantiations of the instance that do
not conform to the FD, we still don't know precisely what b is, and yet it
isn't universally quantified either.
so, while interpretation 2 might be self-consistent, and possibly useful,
and apparently closest to what GHC is doing, it differs from the standard
interpretation of the constructs it would apply to, and should probably
get its own syntactic clues to indicate that difference.
{{{
> class F a b | a -> b where f :: (a,b)
> instance F Int b
}}}
as i can no longer offer an interpretation in which this instance would be
valid (at least not without some extra syntax to indicate the special role
of b in interpretation 2), i agree that it is not. and unless GHC's
interpretation is based on something other than interpretation 2, its
behaviour ought to change. it might be helpful to report the problem not
just as "instance conflicts with FD", as Hugs does, but as "instance is
more general than FD permits".
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1241>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list