TypeFamilies vs. FunctionalDependencies & type-level recursion

Simon Peyton-Jones simonpj at microsoft.com
Wed Jun 15 09:25:35 CEST 2011

| >    class C a b | a -> b where
| >      foo :: a -> b
| >      foo = error "Yo dawg."
| >
| >    instance C a b where
| The instance 'C a b' blatantly violates functional dependency and
| should not have been accepted. The fact that it was is a known bug in
| GHC. The bug keeps getting mentioned on Haskell mailing lists
| about every year. Alas, it is still not fixed. Here is one of the
| earlier messages about it:
|   http://www.haskell.org/pipermail/haskell-cafe/2007-March/023916.html

Wait.  What about
	instance C [a] [b]
?  Should that be accepted?  The Coverage Condition says "no", and indeed it is rejected. But if you add -XUndecidableInstances it is accepted.  

It's just the same for 
	instance C a b
It is rejected, with the same message, unless you add -XUndecidableInstances.

Do you think the two are different?  Do you argue for unconditional rejection of everything not satisfying the Coverage Condition, regardless of flags?


More information about the Haskell-prime mailing list