<div dir="ltr"><div><div><div><div>In Shayan's implementation he has [1]<br><br>data ImplicitBndrs x thing<br>  = IB<br>      (XIB x thing)<br>      thing<br><br>  | NewImplicitBndrs<br>      (XNewImplicitBndrs x thing)<br><br>type family XIB               x thing<br>type family XNewImplicitBndrs x thing<br><br>type ForallXImplicitBndrs c x thing =<br>       ( c (XIB               x thing)<br>       , c (XNewImplicitBndrs x thing)<br>       )<br><br></div>This gets used, in the same file as <br><br>type LSigType   x = ImplicitBndrs x (LType x)<br><br></div>where `thing` is resolved to a specific type.</div><div><br></div><div>Because it is all in the same file, there is no problem making a <br></div><div>constraint on anything using LSigType, that mentions LHsType.<br></div><div><br></div><div><br></div><div><br></div>But in the approach I am taking[2], the type families are defined in<br>HsExtension, which is compiled early in the cycle, and imported by<br>HsTypes, HsBinds, HsDecl etc.<br><div><br></div><div>In order to derive a Data instance for anything using `LSigType x`, we</div><div> need to be able to specify that a Data instance exists for `LHsType x`.</div><div><br></div><div>So we can either do that directly in HsBinds, or try to add it to the existing</div><div> DataId constraint in HsExtension.</div><div><br></div><div><div>The first approach leads to a spread of the constraint throughout the AST,</div><div>which gets very messy.<br> </div><div><br></div></div><div> The second approach requires being able to specify a</div><div>`forall thing. Data thing` constraint in HsExtension.</div><div><br></div><br><div>I tried an intermediate approach, introducing a constraint in HsDecls[3] to capture this,</div><div> but it eventually runs into needing it in the HsExpr.hs-boot file, which means I need</div><div> LHsType in that file.<br></div><br></div>Perhaps the simplest way forward is to get rid of the `thing` parameter completely,<br>and introduce the three or so ImplicitBinders variants that are used.<br><div><br></div><div>I hope this does not just confuse things even more.</div><div><br></div><div><div><div><div><div><div>Alan<br></div><div><br>[1] <a href="https://github.com/ghc/ghc/blob/wip/GrowableAST/compiler/hsSyn/AST.hs#L475">https://github.com/ghc/ghc/blob/wip/GrowableAST/compiler/hsSyn/AST.hs#L475</a></div><div>[2] <a href="https://github.com/ghc/ghc/tree/wip/ttg/2017-10-21">https://github.com/ghc/ghc/tree/wip/ttg/2017-10-21</a><br></div><div>[3] <a href="https://github.com/ghc/ghc/commit/22812296818fe955752fa4762cf72250abd09bf9#diff-7cfa6eef12e44d312aca9ef4af0081b3R1439">https://github.com/ghc/ghc/commit/22812296818fe955752fa4762cf72250abd09bf9#diff-7cfa6eef12e44d312aca9ef4af0081b3R1439</a><br><div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 23 October 2017 at 23:04, Simon Peyton Jones <span dir="ltr"><<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="EN-GB">
<div class="gmail-m_6405570633559935600WordSection1">
<p class="MsoNormal"><span>I’m lost. Could you give me a bit more context?<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>I’m deeply suspicious about that ForallXImplicitBndrs thing with strange higher kinded parameters.   Smells all wrong to me.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Simon<u></u><u></u></span></p>
<p class="MsoNormal"><a name="m_6405570633559935600__MailEndCompose"><span></span></a><br></p></div></div></blockquote></div></div></div></div></div></div></div></div></div></div>