Hi,<div>that&#39;s a bug in GHC---it erroneously accepts polymorphic instances which violate the FD of a class.</div><div>-Iavor<br><br><div class="gmail_quote">On Fri, Mar 18, 2011 at 7:08 AM, Daniel Fischer <span dir="ltr">&lt;<a href="mailto:daniel.is.fischer@googlemail.com">daniel.is.fischer@googlemail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Friday 18 March 2011 14:40:40, JP Moresmau wrote:<br>
&gt; Thanks to you all, I think I understand better.<br>
&gt; instance Search Id Id where<br>
&gt;   search _ _ i = only (FoundId i)<br>
&gt;<br>
&gt; Is too restrictive on the first type, so declaring instead:<br>
&gt; instance Search id Id where<br>
&gt;   search _ _ i = only (FoundId i)<br>
<br>
</div>Not sure what GHC does with that, but at least in spirit that violates the<br>
FunDep of<br>
<br>
class Search id a | a -&gt; id where ...<br>
<br>
Even if it works now, it may well not work in the future.<br>
I&#39;d go for a more stable solution respecting the intent of FunDeps<br>
(i.e. there should only be one type t with an instance Search t Id).<br>
<div class="im"><br>
&gt;<br>
&gt; Fixed the issue!! Now the initial &quot;id&quot; is not Id and everybody is<br>
&gt; happy (and the code still seems to work as intended)<br>
&gt;<br>
&gt; thanks again<br>
&gt;<br>
&gt; JP<br>
<br>
</div><div><div></div><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>