Hello,<br><br><div>There is no problem if an instances uses a type family in it&#39;s assumption---the instances should be accepted only if GHC can see enough of the definition of the type family to ensure that the functional dependency holds.  This is exactly the same as what it would do to check that a super class constraint holds.</div>
<div><br></div><div>-Iavor<br><br><br><div class="gmail_quote">On Wed, May 30, 2012 at 11:14 PM, Etienne Laurin <span dir="ltr">&lt;<a href="mailto:etienne@atnnn.com" target="_blank">etienne@atnnn.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2012/5/31 Iavor Diatchki &lt;<a href="mailto:iavor.diatchki@gmail.com">iavor.diatchki@gmail.com</a>&gt;:<br>
<div class="im">&gt; Hello,<br>
&gt;<br>
&gt; the notion of a functional dependency is well established, and it was used<br>
&gt; well before it was introduced to Haskell (for example, take a look<br>
&gt; at <a href="http://en.wikipedia.org/wiki/Functional_dependency" target="_blank">http://en.wikipedia.org/wiki/Functional_dependency</a>).  So I&#39;d be weary to<br>
&gt; redefine it lightly.<br>
<br>
</div>Indeed, GHC&#39;s functional dependencies are not the same. I see you have<br>
already talked about this on the GHC bug tracker.<br>
<br>
<a href="http://hackage.haskell.org/trac/ghc/ticket/1241" target="_blank">http://hackage.haskell.org/trac/ghc/ticket/1241</a><br>
<div class="im"><br>
&gt; 1. Check that an instance is consistent with itself.  For example, this should be rejected:<br>
&gt;<br>
&gt; instance C a b<br>
&gt;<br>
&gt; because it allows C Int Bool and C Int Char which violate the functional dependency.<br>
<br>
</div>This check may not always be as straightforward. When would this be a<br>
valid instance?<br>
<br>
instance K a b ⇒ C a b<br>
<br>
With a few extra extensions, K could be a type family.<br>
<br>
C currently has the kind (a -&gt; b -&gt; Constraint), with no mention of<br>
functional dependencies. Perhaps the kind of C should include the<br>
functional dependencies of C?<br>
<span class="HOEnZb"><font color="#888888"><br>
Etienne Laurin<br>
</font></span></blockquote></div><br></div>