Reputation: 2697
I was wondering how do you determine the ModuleName
of the file you've just loaded in ghc using the API.
If you look at the Documentation of the API they always assume you know the module name before you load the file in.
I have tried top sorting the dependency graph and picking the last module there, but that doesn't seem to always return the file that was loaded in.
The way I have been able to do it previously was to modify the GHC source code to store this information in the HscEnv
.
It would be nice if the call to load
would return it, But there surely must be a way to do it already since GHCi knows this when it loads a file.
Upvotes: 3
Views: 119