GHC.Unit.Finder
Module finder
Documentation
data FindResult Source #
The result of searching for an imported module.
NB: FindResult manages both user source-import lookups
(which can result in GenModule
) as well as direct imports
for interfaces (which always result in InstalledModule
).
Constructors
Found ModLocation Module | The module was found |
NoPackage Unit | The requested unit was not found |
FoundMultiple [(Module, ModuleOrigin)] | _Error_: both in multiple packages |
NotFound | Not found |
Fields
|
data InstalledFindResult Source #
data FinderOpts Source #
Locations and information the finder cares about.
Should be taken from DynFlags
via initFinderOpts
.
Constructors
FinderOpts | |
Fields
|
Instances
Show FinderOpts Source # | |
Defined in GHC.Unit.Finder.Types |
data FinderCache Source #
flushFinderCaches :: FinderCache -> UnitEnv -> IO () Source #
findImportedModule :: HscEnv -> ModuleName -> PkgQual -> IO FindResult Source #
Locate a module that was imported by the user. We have the module's name, and possibly a package name. Without a package name, this function will use the search path and the known exposed packages to find the module, if a package is specified then only that package is searched for the module.
findPluginModule :: FinderCache -> FinderOpts -> UnitState -> Maybe HomeUnit -> ModuleName -> IO FindResult Source #
Locate a plugin module requested by the user, for a compiler
plugin. This consults the same set of exposed packages as
findImportedModule
, unless -hide-all-plugin-packages
or
-plugin-package
are specified.
findExactModule :: FinderCache -> FinderOpts -> UnitEnvGraph FinderOpts -> UnitState -> Maybe HomeUnit -> InstalledModule -> IO InstalledFindResult Source #
Locate a specific GenModule
. The purpose of this function is to
create a ModLocation
for a given GenModule
, that is to find out
where the files associated with this module live. It is used when
reading the interface for a module mentioned by another interface,
for example (a "system import").
findHomeModule :: FinderCache -> FinderOpts -> HomeUnit -> ModuleName -> IO FindResult Source #
findExposedPackageModule :: FinderCache -> FinderOpts -> UnitState -> ModuleName -> PkgQual -> IO FindResult Source #
mkHomeModLocation :: FinderOpts -> ModuleName -> FilePath -> ModLocation Source #
mkHomeModLocation2 :: FinderOpts -> ModuleName -> FilePath -> String -> ModLocation Source #
mkHiOnlyModLocation :: FinderOpts -> Suffix -> Suffix -> FilePath -> String -> ModLocation Source #
mkHiPath :: FinderOpts -> FilePath -> String -> FilePath Source #
Constructs the filename of a .hi file for a given source file. Does not check whether the .hi file exists
mkObjPath :: FinderOpts -> FilePath -> String -> FilePath Source #
Constructs the filename of a .o file for a given source file. Does not check whether the .o file exists
addModuleToFinder :: FinderCache -> Module -> ModLocation -> IO () Source #
addHomeModuleToFinder :: FinderCache -> HomeUnit -> ModuleName -> ModLocation -> IO Module Source #
uncacheModule :: FinderCache -> HomeUnit -> ModuleName -> IO () Source #
mkStubPaths :: FinderOpts -> ModuleName -> ModLocation -> FilePath Source #
findObjectLinkableMaybe :: Module -> ModLocation -> IO (Maybe Linkable) Source #
lookupFileCache :: FinderCache -> FilePath -> IO Fingerprint Source #