<div dir="ltr">On Fri, Sep 23, 2016 at 3:19 AM, Simon Peyton Jones <span dir="ltr"><<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">





<div lang="EN-GB">
<div>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif">This is an example of
<a href="https://ghc.haskell.org/trac/ghc/ticket/12088" target="_blank">https://ghc.haskell.org/trac/<wbr>ghc/ticket/12088</a>.</span></p></div></div></blockquote><div><br></div><div>Interesting. Is this case also an example, or is it a non-feature?</div><div><br></div><div><div>class C t where</div><div>    type K t :: Type</div><div>    type T t :: K t -> Type</div><div><br></div><div>    m :: t -> T t a</div></div><div><br></div><div><div>min.hs:21:17: error:</div><div>    • Type constructor ‘K’ cannot be used here</div><div>        (it is defined and used in the same recursive group)</div><div>    • In the kind ‘K t -> Type’</div><div>Failed, modules loaded: none.</div></div><div><br></div><div>GHC accepts this if K t is moved outside of C.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-GB"><div><p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif"><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif">The “type instance T List” declaration actually depends on the “type instance K List” declaration; the latter must be typechecked before the former. 
 But this dependency is absolutely unclear.  There’s a long discussion on the thread.  Bottom line: we don’t know a solid automated way to spot this kind of problem, so  I think we are going to ask for programmer assistance.  In this case, we’d put a “separator”
 after the “type instance K List” decl, to explain that it must be done first:<u></u><u></u></span></p><span class="gmail-">
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif"><u></u> <u></u></span></p>
<p class="MsoNormal">    type instance K List = Type<u></u><u></u></p>
</span><p class="MsoNormal">    ===========<u></u><u></u></p><span class="gmail-">
<p class="MsoNormal">    type instance T List = []<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</span><p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif">Currently you have to write $(return []) to get the separator, but I think we’ll add a special separator.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:calibri,sans-serif"><u></u></span></p></div></div></blockquote><div><br></div><div>Yes, this works. Thanks.</div><div><br></div><div>It would be disappointing if this is the best we can do, but I guess other dependent languages don’t need to deal with open type families and everything being potentially mutually recursive.</div></div><div><br></div>-- <br><div class="gmail_signature">Dave Menendez <<a href="mailto:dave@zednenem.com" target="_blank">dave@zednenem.com</a>><br><<a href="http://www.eyrie.org/~zednenem/" target="_blank">http://www.eyrie.org/~zednenem/</a>></div>
</div></div>