Skip to content

Investigate how ghci implements :m +Module #271

@gelisam

Description

@gelisam

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions