Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate how ghci implements :m +Module #271

Open
gelisam opened this issue Aug 18, 2021 · 0 comments
Open

Investigate how ghci implements :m +Module #271

gelisam opened this issue Aug 18, 2021 · 0 comments

Comments

@gelisam
Copy link
Owner

gelisam commented Aug 18, 2021

According to [this Reddit comment](GHCi, version 8.10.4: https://www.haskell.org/ghc/ :? for help Loaded GHCi), the ghci command :m +Module brings into scope all the definitions from the given module and also imports all the modules which this module imports.

Similarly, Hawk brings into scope all the definitions exported from the User Prelude and also imports all the modules which the User Prelude imports, and also sets the same language extensions as those specified in LANGUAGE pragmas in the User Prelude.

The way in which hawk currently implements this is by using haskell-src-exts to parse the User Prelude in order to extract this information, and then to pass out to Hint using setImportQ etc. Since Hint and ghci are both thin wrappers around the ghc api, perhaps there is an easier, more maintainable way to implement this feature, by using whichever function from the ghc api which :m +Module is using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant