
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