<div dir="ltr">Ultimately this is the wrong forum for this discussion as neither type equalities nor functional dependencies are in Haskell&#39; at this time.</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Wed, May 1, 2013 at 7:04 PM, AntC <span dir="ltr">&lt;<a href="mailto:anthony_clayden@clear.net.nz" target="_blank">anthony_clayden@clear.net.nz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&gt; Martin Sulzmann &lt;martin.sulzmann@...&gt; writes:<br>
<div class="im"><br>
&gt; &gt; On Wed, May 1, 2013 at 11:13 AM, AntC &lt;anthony_clayden@...&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt; I want to replace FD&#39;s with Equality Constraints.<br>
&gt;<br>
&gt; Ok, that&#39;s the bit I&#39;ve missed, but then I argue that you can&#39;t fully<br>
&gt; encode FDs.<br>
&gt;<br>
&gt; Consider again the &#39;Sum&#39; example.<br>
&gt;<br>
&gt; In the FD world:<br>
&gt;<br>
&gt; Sum x y z1, Sum x y z2  ==&gt; z1 ~ z2<br>
&gt;<br>
&gt; enforced by<br>
&gt;<br>
&gt; Sum x y z | x y -&gt; z<br>
<br>
</div>I&#39;m still not sure you&#39;ve &#39;got&#39; it. The class has 2 FD&#39;s. Oleg put:<br>
<div class="im">&gt; &gt; &gt;<br>
&gt; &gt; &gt;        class Sum x y z | x y -&gt; z, x z -&gt; y<br>
&gt; &gt; &gt;<br>
<br>
&gt;<br>
</div><div class="im">&gt; In my TF encoding, we find a similar derivation step<br>
&gt;<br>
&gt; SumF1 x y ~ z1, SumF1 x y ~ z2 ==&gt; z1 ~ z2<br>
&gt;<br>
<br>
</div>But you haven&#39;t captured the FD from {result, arg1} -&gt; arg2.<br>
In the TF example you first posted, you expressed that with an explicit<br>
equality constraint. (I won&#39;t repeat yours, because it wasn&#39;t to do with<br>
Peano Arith.)<br>
<div class="im"><br>
<br>
&gt; So, you&#39;re asking can we translate/express FDs using GHC intermediate<br>
&gt; language with plain type equations only?<br>
<br>
</div>No, not asking, but stating; and not talking about the intermediate<br>
language, but the surface language.<br>
<br>
Could I respectfully suggest you re-read the OP.<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
_______________________________________________<br>
Haskell-prime mailing list<br>
<a href="mailto:Haskell-prime@haskell.org">Haskell-prime@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-prime" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-prime</a><br>
</div></div></blockquote></div><br></div>