<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Feb 22, 2022, at 2:42 PM, Benjamin Redelings <<a href="mailto:benjamin.redelings@gmail.com" class="">benjamin.redelings@gmail.com</a>> wrote:</div><div class=""><div class=""><p class="">Then, in order to handle the difference between these two types,
we call `tcSubTypeSigma actual_type more_quantified_type`, which<br class="">
</p><p class="">... It may (I think) eliminate predicates by defaulting, and it can
eliminate types by substituting an ANY type, at least sometimes.
This wrapper is stored inside abe_wrap field of ABE objects,
inside the abs_exports field of the AbsBinds.</p><div class=""><br class=""></div></div></div></blockquote><div><br class=""></div><div>I don't think this step ever does defaulting or uses Any.</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><p class=""><br class="">
</p><p class="">II. I am still not completely sure how the wrapper is actually
applied in code generation, or how the wrapper is computed from
the two types. But, I'm not quite done reading yet.<br class="">
</p><p class="">For example, in the case above, suppose that `tuple` represents
all combined binders inside the AbsBinds, and is quantified by ALL
the type variables and ALL the (given) dictionaries. One approach
would be something like:<br class="">
</p><p class="">tuple = /\a./\b.\(dNum :: Num b). let ...CODE... in (f,g)<br class="">
</p><p class="">f' = /\a./\b.\(dNum :: b). case (tuple @a @b dNum) of f<br class="">
</p><p class="">f = /\a. f' @a @ANY dNum = apply wrapper to f' ?<br class="">
</p><p class="">In that approach, then we would FIRST extract an "f'" from the
tuple without applying any wrapper. Then, SECOND, we would SECOND
apply the wrapper to f' to get f.</p><div class=""><br class=""></div></div></div></blockquote><div>I don't follow here -- sorry. I think you have some typos in your example (for example, there is no -> after 'of' in your 'case', and I see two =s on the last line), and I can't quite figure out what you mean. </div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><p class=""><br class="">
</p><p class="">III. I am also still working through tcMonoBinds. I'm curious
what happens in a pattern binding, when the pattern has a type
signature with predicates:</p><p class="">f:: forall a.Num a -> a->a->a</p><p class="">(f,g) = ...rhs...</p><p class="">It looks like the type signature for gets instantiated on the
LHS, and.... I presume the predicate Num a is added to the local
instance environment, just like if f was instantiated on the
RHS? I will think about this more...<br class=""></p></div></div></blockquote><div>Not sure what you mean here. :( For a pattern binding, I'm pretty sure all the signature does is set what will happen if GHC looks up a symbol's type when processing the RHS.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class=""><p class="">
</p><p class=""><br class="">
</p><p class="">Anyway, thanks for the encouragement. I am not stuck, yet...</p><p class="">All this does make me think that, perhaps, some kind of updated
version of Typing Haskell in Haskell would be appropriate. I'm
not sure how much of this is in the Report, either.<br class=""></p></div></div></blockquote><div>Little, if any, of this is in the Report, and it's unclear to me whether that's a good or a bad thing.</div><div><br class=""></div><div>An up-to-date description of all of this would be lovely! But is it worth it? Especially when this all will continue to change?</div></div><div class=""><br class=""></div><div class="">Keep plugging away! You're definitely working in the right direction.</div><br class=""><div class="">Richard</div></body></html>