How to turn LHExpr GhcPs into CoreExpr

Yiyun Liu liuyiyun at terpmail.umd.edu
Thu Jan 23 04:52:00 UTC 2020


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.

I have the implementation of the function here 
<https://github.com/yiyunliu/ghc-elaboration-test/blob/8f362ad92dc6601b4cb7e4c76f0a42bc6b64480f/src/Main.hs#L55>. 
Not sure if it's 100% correct but at least it works for all the examples 
I can come up with so far.

- Yiyun

On 1/22/20 7:09 AM, Andreas Klebinger wrote:
> 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.
> I gave up on that when some of the calls failed because I must have 
> missed to set up some implicit state properly.
> 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.
>
> I would also support adding any missing functions to GHC-the-library 
> to make this possible if any turn out to be required.
>
> 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.
> But I expect that to be slower if you expect to process many such 
> strings,
>
> Richard Eisenberg schrieb am 22.01.2020 um 10:36:
>> You'll need to run the expression through the whole pipeline.
>>
>> 1. Parsing
>> 2. Renaming
>> 3. Type-checking
>> 3a. Constraint generation
>>   3b. Constraint solving
>>   3c. Zonking
>> 4. Desugaring
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200122/7374dd5e/attachment.html>


More information about the ghc-devs mailing list