[Haskell-cafe] Fundeps and overlapping instances
etienne at atnnn.com
Thu May 31 08:14:02 CEST 2012
2012/5/31 Iavor Diatchki <iavor.diatchki at gmail.com>:
> the notion of a functional dependency is well established, and it was used
> well before it was introduced to Haskell (for example, take a look
> at http://en.wikipedia.org/wiki/Functional_dependency). So I'd be weary to
> redefine it lightly.
Indeed, GHC's functional dependencies are not the same. I see you have
already talked about this on the GHC bug tracker.
> 1. Check that an instance is consistent with itself. For example, this should be rejected:
> instance C a b
> because it allows C Int Bool and C Int Char which violate the functional dependency.
This check may not always be as straightforward. When would this be a
instance K a b ⇒ C a b
With a few extra extensions, K could be a type family.
C currently has the kind (a -> b -> Constraint), with no mention of
functional dependencies. Perhaps the kind of C should include the
functional dependencies of C?
More information about the Haskell-Cafe