GHC API question: resolving dependencies for modules

Dmitriy Kovanikov kovanikov at gmail.com
Thu Jun 21 09:06:39 UTC 2018


Hello!

I’m trying to use GHC as a library. And my goal is to be able to gather information about where each function or data type came from. I’ve started by simply calling `getNamesInScope` function and observing its result. Here is my code:

* Main.hs: https://lpaste.net/9026688686753841152 <https://lpaste.net/9026688686753841152>

And here is the code for my test modules:

* test/X.hs: https://lpaste.net/6844657232357883904 <https://lpaste.net/6844657232357883904>
* test/Y.hs: https://lpaste.net/8673289058127970304 <https://lpaste.net/8673289058127970304>

Unfortunately, my implementation doesn't work since I’m not very familiar with GHC API. 
And I see the following errors after executing my `Main.hs` file (I’m using ghc-8.2.2):

* error messages: https://lpaste.net/3316737208131518464 <https://lpaste.net/3316737208131518464>

Could you please point me to places or parts of GHC API or some documentation about module dependencies and how to make ghc see imports of other modules? I can’t find simple and small enough usage example of this part of the library.

Thanks in advance,
Dmitrii Kovanikov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180621/970491f0/attachment.html>


More information about the ghc-devs mailing list