ghc-8.0.0.20160421: The GHC API

Safe HaskellNone
LanguageHaskell2010

Finder

Synopsis

Documentation

data FindResult Source #

The result of searching for an imported module.

Constructors

Found ModLocation Module

The module was found

NoPackage UnitId

The requested package was not found

FoundMultiple [(Module, ModuleOrigin)]

_Error_: both in multiple packages

NotFound

Not found

findImportedModule :: HscEnv -> ModuleName -> Maybe FastString -> 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 :: HscEnv -> 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 :: HscEnv -> Module -> IO FindResult Source #

Locate a specific Module. The purpose of this function is to create a ModLocation for a given Module, 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 :: HscEnv -> ModuleName -> IO FindResult Source #

Implements the search for a module name in the home package only. Calling this function directly is usually *not* what you want; currently, it's used as a building block for the following operations:

  1. When you do a normal package lookup, we first check if the module is available in the home module, before looking it up in the package database.
  2. When you have a package qualified import with package name "this", we shortcut to the home module.
  3. When we look up an exact Module, if the unit id associated with the module is the current home module do a look up in the home module.
  4. Some special-case code in GHCi (ToDo: Figure out why that needs to call this.)

mkHiPath :: DynFlags -> 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 :: DynFlags -> FilePath -> String -> FilePath Source #

Constructs the filename of a .o file for a given source file. Does not check whether the .o file exists