<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Yes, I finished and pushed in December. A description of the design and how to use the feature is here:</div><div><a href="http://hackage.haskell.org/trac/ghc/wiki/NewAxioms">http://hackage.haskell.org/trac/ghc/wiki/NewAxioms</a></div><div><br></div><div>There's also a section (7.7.2.2 to be exact) in the manual, but building the manual from source is not for the faint of heart.</div><div><br></div><div>Richard</div><br><div><div>On Jan 10, 2013, at 3:14 PM, Carter Schonwald &lt;<a href="mailto:carter.schonwald@gmail.com">carter.schonwald@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">so the overlapping type families &nbsp;are in HEAD?<div><br></div><div style="">Awesome! I look forward to finding some time to try them out :)&nbsp;</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 1:56 PM, Richard Eisenberg <span dir="ltr">&lt;<a href="mailto:eir@cis.upenn.edu" target="_blank">eir@cis.upenn.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>For better or worse, the new overlapping type family instances use a different overlapping mechanism than functional dependencies do. Class instances that overlap are chosen among by order of specificity; overlapping instances can be declared in separate modules. Overlapping family instances must be given an explicit order, and those that overlap must all be in the same module. The decision to make these different was to avoid type soundness issues that would arise with overlapping type family instances declared in separate modules. (Ordering a set of family instance equations by specificity, on the other hand, could easily be done within GHC.)</div>

<br>I agree with Iavor that it is fairly straight-forward to extend FC to support FD-style type improvement. In fact, I've formalized such a proof language in a PPDP'06 paper:<br>"Extracting programs from type class proofs"<br>

(type improvement comes only at the end)<br><br>Similar to FC, coercions (proof terms) are used to represent type equations (improvement).<br><br>Why extend FC?<br>Why not simply use type families to encode FDs (and thus keep FC simple and small).<br>

<br>It's been a while, but as far as I remember, the encoding is only problematic in case of the combination of FDs and overlapping instances. Shouldn't this now be fixable given<br>that type family instances can be overlapping?<br>

<div link="blue" vlink="purple" lang="EN-GB">
<div><div><p class="MsoNormal" style="margin-left:36.0pt">As far as I understand, the reason that GHC does not construct such proofs is that it can't express them in its internal proof language (System FC). &nbsp;<u></u><u></u></p><p class="MsoNormal" style="margin-left:36.0pt"><u></u>&nbsp;<u></u></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d">Iavor is quite right<u></u><u></u></span></p><div><p class="MsoNormal" style="margin-left:36.0pt">

<u></u>&nbsp;<u></u></p><p class="MsoNormal" style="margin-left:36.0pt">It seems to me that it should be fairly straight-forward to extend FC to support this sort of proof, but I have not been able to convince folks that this is the case. &nbsp;I could elaborate, if there's interest.<u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>&nbsp;<u></u></span></p>
</div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d">Iavor: I don’t think it’s straightforward, but I’m willing to be educated.&nbsp; By all means start a wiki page to explain how, if you think it is.&nbsp;
<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>&nbsp;<u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d">I do agree that injective type families would be a good thing, and would deal with the main reason that fundeps are sometimes better than type families.&nbsp; A
good start would be to begin a wiki page to flesh out the design issues, perhaps linked from
<a href="http://hackage.haskell.org/trac/ghc/wiki/TypeFunctions" target="_blank">http://hackage.haskell.org/trac/ghc/wiki/TypeFunctions</a><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>&nbsp;<u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d">The main issues are, I think:<u></u><u></u></span></p><p><u></u><span style="font-size:11.0pt;font-family:Symbol;color:#1f497d"><span>·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d">How to express functional dependencies like “fixing the result type and the first argument will fix the second argument”<u></u><u></u></span></p><p><u></u><span style="font-size:11.0pt;font-family:Symbol;color:#1f497d"><span>·<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d">How to express that idea in the proof language<u></u><u></u></span></p><p class="MsoNormal">

<span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>&nbsp;<u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d">Simon<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;color:#1f497d"><u></u>&nbsp;<u></u></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;" lang="EN-US"> <a href="mailto:glasgow-haskell-bugs-bounces@haskell.org" target="_blank">glasgow-haskell-bugs-bounces@haskell.org</a> [mailto:<a href="mailto:glasgow-haskell-bugs-bounces@haskell.org" target="_blank">glasgow-haskell-bugs-bounces@haskell.org</a>]
<b>On Behalf Of </b>Iavor Diatchki<br>
<b>Sent:</b> 26 December 2012 02:48<br>
<b>To:</b> Conal Elliott<br>
<b>Cc:</b> <a href="mailto:glasgow-haskell-bugs@haskell.org" target="_blank">glasgow-haskell-bugs@haskell.org</a>; GHC Users Mailing List<br>
<b>Subject:</b> Re: Fundeps and type equality<u></u><u></u></span></p>
</div>
</div><div><p class="MsoNormal"><u></u>&nbsp;<u></u></p>
<div><p class="MsoNormal">Hello Conal,<u></u><u></u></p>
<div><p class="MsoNormal"><u></u>&nbsp;<u></u></p>
</div>
<div><p class="MsoNormal">GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e., to determine the values of free type variables), but it will not use them in proofs, which is what is needed in
examples like the one you posted. &nbsp;The reason some proving is needed is that the compiler needs to figure out that for each instantiation of the type `ta` and `tb` will be the same (which, of course, follows directly from the FD on the class).<u></u><u></u></p>

</div>
<div><p class="MsoNormal"><u></u>&nbsp;<u></u></p>
</div>
<div><p class="MsoNormal">As far as I understand, the reason that GHC does not construct such proofs is that it can't express them in its internal proof language (System FC). &nbsp;It seems to me that it should be fairly straight-forward to extend FC to support this
sort of proof, but I have not been able to convince folks that this is the case. &nbsp;I could elaborate, if there's interest.<u></u><u></u></p>
</div>
<div><p class="MsoNormal"><u></u>&nbsp;<u></u></p>
</div>
<div><p class="MsoNormal">In the mean time, the way forward would probably be to express the dependency using type families, which I find tends to be more verbose but, at present, is better supported in GHC.<u></u><u></u></p>