<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="">It is slightly disheartening that this relatively simple use-case requires reaching so deeply into the typechecker.<br><br>If there really exusts no easier interface then perhaps we should consider adopting your elaborateExpr as part of the GHC API.<br><br>Cheers, <br><br>- Ben <br><br><div class="gmail_quote">On January 23, 2020 4:04:03 AM EST, Richard Eisenberg <rae@richarde.dev> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I don't know the exact semantics of the interactive context, etc., but that looks plausible. It won't give the *wrong* answer. :)<div class=""><br class=""></div><div class="">Thanks for sharing!</div><div class="">Richard<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 23, 2020, at 4:52 AM, Yiyun Liu <<a href="mailto:liuyiyun@terpmail.umd.edu" class="">liuyiyun@terpmail.umd.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252" class="">
<div class=""><p class="">Thank you all for your help! It turns out that I was missing the
constraint solving and zonking step by desugaring the result of
tcInferSigma directly.<br class="">
</p><p class="">I have the implementation of the function <a moz-do-not-send="true" href="https://github.com/yiyunliu/ghc-elaboration-test/blob/8f362ad92dc6601b4cb7e4c76f0a42bc6b64480f/src/Main.hs#L55" class="">here</a>.
Not sure if it's 100% correct but at least it works for all the
examples I can come up with so far.<br class="">
</p><p class="">- Yiyun<br class="">
</p>
<div class="moz-cite-prefix">On 1/22/20 7:09 AM, Andreas Klebinger
wrote:<br class="">
</div>
<blockquote type="cite" cite="mid:6c1ee9c9-a759-e246-aa9b-2e129b3ecfa8@gmx.at" class="">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252" class="">
I tried this for fun a
while ago and ran into the issue of needing to provide a type
environment containing Prelude and so on.<br class="">
I gave up on that when some of the calls failed because I must
have
missed to set up some implicit state properly.<br class="">
I didn't have an actual use case (only curiosity) so I didn't look
further into it. If you do find a way please let me know.<br class="">
<br class="">
I would also support adding any missing functions to
GHC-the-library to
make this possible if any turn out to be required.<br class="">
<br class="">
As an alternative you could also use the GHCi approach of using a
fake
Module. This would allow you to copy whatever GHCi is doing.<br class="">
But I expect that to be slower if you expect to process many such
strings, <br class="">
<br class="">
<span class="">Richard Eisenberg schrieb am 22.01.2020 um 10:36:</span><br class="">
<blockquote type="cite" cite="mid:07D49BF1-AC80-4E91-B14C-7F8BEB82F47C@richarde.dev" class="">You'll
need to run the expression through the whole pipeline.
<div class=""><br class="">
</div>
<div class="">1. Parsing</div>
<div class="">2. Renaming</div>
<div class="">3. Type-checking</div>
<div class=""> <span style="display: inline; font-size:
inherit;
padding: 0px;" class=" __postbox-detected-date __postbox-detected-content
" __postbox-detected-content="__postbox-detected-date"><span style="display: inline; font-size: inherit; padding: 0px;" class="__postbox-detected-date __postbox-detected-content" __postbox-detected-content="__postbox-detected-date">3a.</span></span>
Constraint generation</div>
<div class=""> 3b. Constraint solving</div>
<div class=""> 3c. Zonking</div>
<div class="">4. Desugaring</div>
</blockquote>
<br class="">
</blockquote>
</div>
</div></blockquote></div><br class=""></div></blockquote></div><br>-- <br>Sent from my Android device with K-9 Mail. Please excuse my brevity.</body></html>