- compilation state
- Information about modules
- Information about the module being compiled
- State relating to modules in this package
- State relating to known packages
- Annotations
- Interactive context
- Interfaces
- Fixity
- TyThings and type environments
- MonadThings
- Information on imports and exports
- Warnings
- Linker stuff
- Program coverage
- Breakpoints
- Vectorisation information
- Safe Haskell information
- Compilation errors and warnings
Types for the per-module compiler
- data HscEnv = HscEnv {
- hsc_dflags :: DynFlags
- hsc_targets :: [Target]
- hsc_mod_graph :: ModuleGraph
- hsc_IC :: InteractiveContext
- hsc_HPT :: HomePackageTable
- hsc_EPS :: !(IORef ExternalPackageState)
- hsc_NC :: !(IORef NameCache)
- hsc_FC :: !(IORef FinderCache)
- hsc_MLC :: !(IORef ModLocationCache)
- hsc_OptFuel :: OptFuelState
- hsc_type_env_var :: Maybe (Module, IORef TypeEnv)
- hscEPS :: HscEnv -> IO ExternalPackageState
- type FinderCache = ModuleNameEnv FindResult
- data FindResult
- = Found ModLocation Module
- | NoPackage PackageId
- | FoundMultiple [PackageId]
- | NotFound {
- fr_paths :: [FilePath]
- fr_pkg :: Maybe PackageId
- fr_mods_hidden :: [PackageId]
- fr_pkgs_hidden :: [PackageId]
- fr_suggestions :: [Module]
- type ModLocationCache = ModuleEnv ModLocation
- data Target = Target {}
- data TargetId
- pprTarget :: Target -> SDoc
- pprTargetId :: TargetId -> SDoc
- type ModuleGraph = [ModSummary]
- emptyMG :: ModuleGraph
- data ModDetails = ModDetails {
- md_exports :: [AvailInfo]
- md_types :: !TypeEnv
- md_insts :: ![Instance]
- md_fam_insts :: ![FamInst]
- md_rules :: ![CoreRule]
- md_anns :: ![Annotation]
- md_vect_info :: !VectInfo
- emptyModDetails :: ModDetails
- data ModGuts = ModGuts {
- mg_module :: !Module
- mg_boot :: IsBootInterface
- mg_exports :: ![AvailInfo]
- mg_deps :: !Dependencies
- mg_dir_imps :: !ImportedMods
- mg_used_names :: !NameSet
- mg_used_th :: !Bool
- mg_rdr_env :: !GlobalRdrEnv
- mg_fix_env :: !FixityEnv
- mg_types :: !TypeEnv
- mg_insts :: ![Instance]
- mg_fam_insts :: ![FamInst]
- mg_rules :: ![CoreRule]
- mg_binds :: ![CoreBind]
- mg_foreign :: !ForeignStubs
- mg_warns :: !Warnings
- mg_anns :: [Annotation]
- mg_hpc_info :: !HpcInfo
- mg_modBreaks :: !ModBreaks
- mg_vect_decls :: ![CoreVect]
- mg_vect_info :: !VectInfo
- mg_inst_env :: InstEnv
- mg_fam_inst_env :: FamInstEnv
- mg_trust_pkg :: Bool
- data CgGuts = CgGuts {
- cg_module :: !Module
- cg_tycons :: [TyCon]
- cg_binds :: [CoreBind]
- cg_foreign :: !ForeignStubs
- cg_dep_pkgs :: ![PackageId]
- cg_hpc_info :: !HpcInfo
- cg_modBreaks :: !ModBreaks
- data ForeignStubs
- = NoStubs
- | ForeignStubs SDoc SDoc
- appendStubC :: ForeignStubs -> SDoc -> ForeignStubs
- type ImportedMods = ModuleEnv [ImportedModsVal]
- type ImportedModsVal = (ModuleName, Bool, SrcSpan, IsSafeImport)
- data ModSummary = ModSummary {}
- ms_imps :: ModSummary -> [Located (ImportDecl RdrName)]
- ms_mod_name :: ModSummary -> ModuleName
- showModMsg :: HscTarget -> Bool -> ModSummary -> String
- isBootSummary :: ModSummary -> Bool
- msHsFilePath, msObjFilePath, msHiFilePath :: ModSummary -> FilePath
- data SourceModified
- data HscSource
- = HsSrcFile
- | HsBootFile
- | ExtCoreFile
- isHsBoot :: HscSource -> Bool
- hscSourceString :: HscSource -> String
- type HomePackageTable = ModuleNameEnv HomeModInfo
- data HomeModInfo = HomeModInfo {
- hm_iface :: !ModIface
- hm_details :: !ModDetails
- hm_linkable :: !(Maybe Linkable)
- emptyHomePackageTable :: HomePackageTable
- hptInstances :: HscEnv -> (ModuleName -> Bool) -> ([Instance], [FamInst])
- hptRules :: HscEnv -> [(ModuleName, IsBootInterface)] -> [CoreRule]
- hptVectInfo :: HscEnv -> VectInfo
- hptObjs :: HomePackageTable -> [FilePath]
- data ExternalPackageState = EPS {
- eps_is_boot :: !(ModuleNameEnv (ModuleName, IsBootInterface))
- eps_PIT :: !PackageIfaceTable
- eps_PTE :: !PackageTypeEnv
- eps_inst_env :: !PackageInstEnv
- eps_fam_inst_env :: !PackageFamInstEnv
- eps_rule_base :: !PackageRuleBase
- eps_vect_info :: !PackageVectInfo
- eps_ann_env :: !PackageAnnEnv
- eps_mod_fam_inst_env :: !(ModuleEnv FamInstEnv)
- eps_stats :: !EpsStats
- data EpsStats = EpsStats {
- n_ifaces_in :: !Int
- n_decls_in :: !Int
- n_decls_out :: !Int
- n_rules_in :: !Int
- n_rules_out :: !Int
- n_insts_in :: !Int
- n_insts_out :: !Int
- addEpsInStats :: EpsStats -> Int -> Int -> Int -> EpsStats
- type PackageTypeEnv = TypeEnv
- type PackageIfaceTable = ModuleEnv ModIface
- emptyPackageIfaceTable :: PackageIfaceTable
- lookupIfaceByModule :: DynFlags -> HomePackageTable -> PackageIfaceTable -> Module -> Maybe ModIface
- emptyModIface :: Module -> ModIface
- type PackageInstEnv = InstEnv
- type PackageRuleBase = RuleBase
- prepareAnnotations :: HscEnv -> Maybe ModGuts -> IO AnnEnv
- data InteractiveContext = InteractiveContext {
- ic_toplev_scope :: [Module]
- ic_imports :: [ImportDecl RdrName]
- ic_rn_gbl_env :: GlobalRdrEnv
- ic_tmp_ids :: [Id]
- ic_resume :: [Resume]
- ic_cwd :: Maybe FilePath
- emptyInteractiveContext :: InteractiveContext
- icPrintUnqual :: DynFlags -> InteractiveContext -> PrintUnqualified
- extendInteractiveContext :: InteractiveContext -> [Id] -> InteractiveContext
- substInteractiveContext :: InteractiveContext -> TvSubst -> InteractiveContext
- mkPrintUnqualified :: DynFlags -> GlobalRdrEnv -> PrintUnqualified
- pprModulePrefix :: PprStyle -> Module -> OccName -> SDoc
- data ModIface = ModIface {
- mi_module :: !Module
- mi_iface_hash :: !Fingerprint
- mi_mod_hash :: !Fingerprint
- mi_orphan :: !WhetherHasOrphans
- mi_finsts :: !WhetherHasFamInst
- mi_boot :: !IsBootInterface
- mi_deps :: Dependencies
- mi_usages :: [Usage]
- mi_exports :: ![IfaceExport]
- mi_exp_hash :: !Fingerprint
- mi_used_th :: !Bool
- mi_fixities :: [(OccName, Fixity)]
- mi_warns :: Warnings
- mi_anns :: [IfaceAnnotation]
- mi_decls :: [(Fingerprint, IfaceDecl)]
- mi_globals :: !(Maybe GlobalRdrEnv)
- mi_insts :: [IfaceInst]
- mi_fam_insts :: [IfaceFamInst]
- mi_rules :: [IfaceRule]
- mi_orphan_hash :: !Fingerprint
- mi_vect_info :: !IfaceVectInfo
- mi_warn_fn :: Name -> Maybe WarningTxt
- mi_fix_fn :: OccName -> Fixity
- mi_hash_fn :: OccName -> Maybe (OccName, Fingerprint)
- mi_hpc :: !AnyHpcUsage
- mi_trust :: !IfaceTrustInfo
- mi_trust_pkg :: !Bool
- mkIfaceWarnCache :: Warnings -> Name -> Maybe WarningTxt
- mkIfaceHashCache :: [(Fingerprint, IfaceDecl)] -> OccName -> Maybe (OccName, Fingerprint)
- mkIfaceFixCache :: [(OccName, Fixity)] -> OccName -> Fixity
- emptyIfaceWarnCache :: Name -> Maybe WarningTxt
- type FixityEnv = NameEnv FixItem
- data FixItem = FixItem OccName Fixity
- lookupFixity :: FixityEnv -> Name -> Fixity
- emptyFixityEnv :: FixityEnv
- data TyThing
- tyThingClass :: TyThing -> Class
- tyThingTyCon :: TyThing -> TyCon
- tyThingDataCon :: TyThing -> DataCon
- tyThingId :: TyThing -> Id
- tyThingCoAxiom :: TyThing -> CoAxiom
- implicitTyThings :: TyThing -> [TyThing]
- implicitTyConThings :: TyCon -> [TyThing]
- implicitClassThings :: Class -> [TyThing]
- isImplicitTyThing :: TyThing -> Bool
- type TypeEnv = NameEnv TyThing
- lookupType :: DynFlags -> HomePackageTable -> PackageTypeEnv -> Name -> Maybe TyThing
- lookupTypeHscEnv :: HscEnv -> Name -> IO (Maybe TyThing)
- mkTypeEnv :: [TyThing] -> TypeEnv
- emptyTypeEnv :: TypeEnv
- extendTypeEnv :: TypeEnv -> TyThing -> TypeEnv
- extendTypeEnvList :: TypeEnv -> [TyThing] -> TypeEnv
- extendTypeEnvWithIds :: TypeEnv -> [Id] -> TypeEnv
- lookupTypeEnv :: TypeEnv -> Name -> Maybe TyThing
- typeEnvElts :: TypeEnv -> [TyThing]
- typeEnvClasses :: TypeEnv -> [Class]
- typeEnvTyCons :: TypeEnv -> [TyCon]
- typeEnvIds :: TypeEnv -> [Id]
- typeEnvDataCons :: TypeEnv -> [DataCon]
- typeEnvCoAxioms :: TypeEnv -> [CoAxiom]
- class Monad m => MonadThings m where
- lookupThing :: Name -> m TyThing
- lookupId :: Name -> m Id
- lookupDataCon :: Name -> m DataCon
- lookupTyCon :: Name -> m TyCon
- lookupClass :: Name -> m Class
- type WhetherHasOrphans = Bool
- type IsBootInterface = Bool
- data Usage
- = UsagePackageModule { }
- | UsageHomeModule { }
- data Dependencies = Deps {
- dep_mods :: [(ModuleName, IsBootInterface)]
- dep_pkgs :: [(PackageId, Bool)]
- dep_orphs :: [Module]
- dep_finsts :: [Module]
- noDependencies :: Dependencies
- data NameCache = NameCache {}
- type OrigNameCache = ModuleEnv (OccEnv Name)
- type OrigIParamCache = Map (IPName OccName) (IPName Name)
- type Avails = [AvailInfo]
- availsToNameSet :: [AvailInfo] -> NameSet
- availsToNameEnv :: [AvailInfo] -> NameEnv AvailInfo
- availName :: AvailInfo -> Name
- availNames :: AvailInfo -> [Name]
- data AvailInfo
- type IfaceExport = AvailInfo
- stableAvailCmp :: AvailInfo -> AvailInfo -> Ordering
- data Warnings
- = NoWarnings
- | WarnAll WarningTxt
- | WarnSome [(OccName, WarningTxt)]
- data WarningTxt
- = WarningTxt [FastString]
- | DeprecatedTxt [FastString]
- plusWarns :: Warnings -> Warnings -> Warnings
- data Linkable = LM {}
- isObjectLinkable :: Linkable -> Bool
- linkableObjs :: Linkable -> [FilePath]
- data Unlinked
- data CompiledByteCode
- isObject :: Unlinked -> Bool
- nameOfObject :: Unlinked -> FilePath
- isInterpretable :: Unlinked -> Bool
- byteCodeOfObject :: Unlinked -> CompiledByteCode
- data HpcInfo
- emptyHpcInfo :: AnyHpcUsage -> HpcInfo
- isHpcUsed :: HpcInfo -> AnyHpcUsage
- type AnyHpcUsage = Bool
- data ModBreaks = ModBreaks {
- modBreaks_flags :: BreakArray
- modBreaks_locs :: !(Array BreakIndex SrcSpan)
- modBreaks_vars :: !(Array BreakIndex [OccName])
- modBreaks_decls :: !(Array BreakIndex [String])
- type BreakIndex = Int
- emptyModBreaks :: ModBreaks
- data VectInfo = VectInfo {
- vectInfoVar :: VarEnv (Var, Var)
- vectInfoTyCon :: NameEnv (TyCon, TyCon)
- vectInfoDataCon :: NameEnv (DataCon, DataCon)
- vectInfoPADFun :: NameEnv (TyCon, Var)
- vectInfoIso :: NameEnv (TyCon, Var)
- vectInfoScalarVars :: VarSet
- vectInfoScalarTyCons :: NameSet
- data IfaceVectInfo = IfaceVectInfo {}
- noVectInfo :: VectInfo
- plusVectInfo :: VectInfo -> VectInfo -> VectInfo
- noIfaceVectInfo :: IfaceVectInfo
- data IfaceTrustInfo
- getSafeMode :: IfaceTrustInfo -> SafeHaskellMode
- setSafeMode :: SafeHaskellMode -> IfaceTrustInfo
- noIfaceTrustInfo :: IfaceTrustInfo
- trustInfoToNum :: IfaceTrustInfo -> Word8
- numToTrustInfo :: Word8 -> IfaceTrustInfo
- type IsSafeImport = Bool
- data SourceError
- data GhcApiError
- mkSrcErr :: ErrorMessages -> SourceError
- srcErrorMessages :: SourceError -> ErrorMessages
- mkApiErr :: SDoc -> GhcApiError
- throwOneError :: MonadIO m => ErrMsg -> m ab
- handleSourceError :: ExceptionMonad m => (SourceError -> m a) -> m a -> m a
- handleFlagWarnings :: DynFlags -> [Located String] -> IO ()
- printOrThrowWarnings :: DynFlags -> Bag WarnMsg -> IO ()
compilation state
Hscenv is like Session
, except that some of the fields are immutable.
An HscEnv is used to compile a single module from plain Haskell source
code (after preprocessing) to either C, assembly or C--. Things like
the module graph don't change during a single compilation.
Historical note: "hsc" used to be the name of the compiler binary, when there was a separate driver and compiler. To compile a single module, the driver would invoke hsc on the source code... so nowadays we think of hsc as the layer of the compiler that deals with compiling a single module.
HscEnv | |
|
type FinderCache = ModuleNameEnv FindResultSource
The FinderCache
maps home module names to the result of
searching for that module. It records the results of searching for
modules along the search path. On :load
, we flush the entire
contents of this cache.
Although the FinderCache
range is FindResult
for convenience ,
in fact it will only ever contain Found
or NotFound
entries.
data FindResult Source
The result of searching for an imported module.
Found ModLocation Module | The module was found |
NoPackage PackageId | The requested package was not found |
FoundMultiple [PackageId] | _Error_: both in multiple packages |
NotFound | |
|
type ModLocationCache = ModuleEnv ModLocationSource
Cache that remembers where we found a particular module. Contains both
home modules and package modules. On :load
, only home modules are
purged from this cache.
A compilation target.
A target may be supplied with the actual text of the module. If so, use this instead of the file contents (this is for use in an IDE where the file hasn't been saved by the user yet).
Target | |
|
TargetModule ModuleName | A module name: search for the file |
TargetFile FilePath (Maybe Phase) | A filename: preprocess & parse it to find the module name. If specified, the Phase indicates how to compile this file (which phase to start from). Nothing indicates the starting phase should be determined from the suffix of the filename. |
pprTargetId :: TargetId -> SDocSource
type ModuleGraph = [ModSummary]Source
A ModuleGraph contains all the nodes from the home package (only). There will be a node for each source module, plus a node for each hi-boot module.
The graph is not necessarily stored in topologically-sorted order. Use
GHC.topSortModuleGraph
and Digraph.flattenSCC
to achieve this.
Information about modules
data ModDetails Source
The ModDetails
is essentially a cache for information in the ModIface
for home modules only. Information relating to packages will be loaded into
global environments in ExternalPackageState
.
ModDetails | |
|
A ModGuts is carried through the compiler, accumulating stuff as it goes
There is only one ModGuts at any time, the one for the module
being compiled right now. Once it is compiled, a ModIface
and
ModDetails
are extracted and the ModGuts is discarded.
ModGuts | |
|
A restricted form of ModGuts
for code generation purposes
CgGuts | |
|
data ForeignStubs Source
Foreign export stubs
NoStubs | We don't have any stubs |
ForeignStubs SDoc SDoc | There are some stubs. Parameters: 1) Header file prototypes for foreign exported functions 2) C stubs to use when calling foreign exported functions |
appendStubC :: ForeignStubs -> SDoc -> ForeignStubsSource
type ImportedMods = ModuleEnv [ImportedModsVal]Source
Records the modules directly imported by a module for extracting e.g. usage information
type ImportedModsVal = (ModuleName, Bool, SrcSpan, IsSafeImport)Source
data ModSummary Source
A single node in a 'ModuleGraph. The nodes of the module graph are one of:
- A regular Haskell source module
- A hi-boot source module
- An external-core source module
ModSummary | |
|
ms_imps :: ModSummary -> [Located (ImportDecl RdrName)]Source
showModMsg :: HscTarget -> Bool -> ModSummary -> StringSource
isBootSummary :: ModSummary -> BoolSource
Did this ModSummary
originate from a hs-boot file?
data SourceModified Source
Indicates whether a given module's source has been modified since it was last compiled.
SourceModified | the source has been modified |
SourceUnmodified | the source has not been modified. Compilation may or may not be necessary, depending on whether any dependencies have changed since we last compiled. |
SourceUnmodifiedAndStable | the source has not been modified, and furthermore all of its (transitive) dependencies are up to date; it definitely does not need to be recompiled. This is important for two reasons: (a) we can omit the version check in checkOldIface, and (b) if the module used TH splices we don't need to force recompilation. |
Information about the module being compiled
State relating to modules in this package
type HomePackageTable = ModuleNameEnv HomeModInfoSource
Helps us find information about modules in the home package
data HomeModInfo Source
Information about modules in the package being compiled
HomeModInfo | |
|
hptInstances :: HscEnv -> (ModuleName -> Bool) -> ([Instance], [FamInst])Source
Find all the instance declarations (of classes and families) that are in
modules imported by this one, directly or indirectly, and are in the Home
Package Table. This ensures that we don't see instances from modules --make
compiled before this one, but which are not below this one.
hptRules :: HscEnv -> [(ModuleName, IsBootInterface)] -> [CoreRule]Source
Get rules from modules "below" this one (in the dependency sense)
hptVectInfo :: HscEnv -> VectInfoSource
Get the combined VectInfo of all modules in the home package table. In contrast to instances and rules, we don't care whether the modules are "below" us in the dependency sense. The VectInfo of those modules not "below" us does not affect the compilation of the current module.
hptObjs :: HomePackageTable -> [FilePath]Source
State relating to known packages
data ExternalPackageState Source
Information about other packages that we have slurped in by reading their interface files
EPS | |
|
Accumulated statistics about what we are putting into the ExternalPackageState
.
"In" means stuff that is just read from interface files,
"Out" means actually sucked in and type-checked
EpsStats | |
|
addEpsInStats :: EpsStats -> Int -> Int -> Int -> EpsStatsSource
Add stats for one newly-read interface
type PackageTypeEnv = TypeEnvSource
type PackageIfaceTable = ModuleEnv ModIfaceSource
Helps us find information about modules in the imported packages
lookupIfaceByModule :: DynFlags -> HomePackageTable -> PackageIfaceTable -> Module -> Maybe ModIfaceSource
type PackageInstEnv = InstEnvSource
type PackageRuleBase = RuleBaseSource
Annotations
prepareAnnotations :: HscEnv -> Maybe ModGuts -> IO AnnEnvSource
Deal with gathering annotations in from all possible places
and combining them into a single AnnEnv
Interactive context
data InteractiveContext Source
Interactive context, recording information about the state of the context in which statements are executed in a GHC session.
InteractiveContext | |
|
mkPrintUnqualified :: DynFlags -> GlobalRdrEnv -> PrintUnqualifiedSource
Creates some functions that work out the best ways to format names for the user according to a set of heuristics
Interfaces
A ModIface
plus a ModDetails
summarises everything we know
about a compiled module. The ModIface
is the stuff *before* linking,
and can be written out to an interface file. The 'ModDetails is after
linking and can be completely recovered from just the ModIface
.
When we read an interface file, we also construct a ModIface
from it,
except that we explicitly make the mi_decls
and a few other fields empty;
as when reading we consolidate the declarations etc. into a number of indexed
maps and environments in the ExternalPackageState
.
ModIface | |
|
mkIfaceWarnCache :: Warnings -> Name -> Maybe WarningTxtSource
Constructs the cache for the mi_warn_fn
field of a ModIface
mkIfaceHashCache :: [(Fingerprint, IfaceDecl)] -> OccName -> Maybe (OccName, Fingerprint)Source
Constructs cache for the mi_hash_fn
field of a ModIface
Fixity
Fixity information for an Name
. We keep the OccName in the range
so that we can generate an interface from it
lookupFixity :: FixityEnv -> Name -> FixitySource
TyThings and type environments
A typecheckable-thing, essentially anything that has a name
tyThingClass :: TyThing -> ClassSource
tyThingTyCon :: TyThing -> TyConSource
implicitTyThings :: TyThing -> [TyThing]Source
implicitTyConThings :: TyCon -> [TyThing]Source
implicitClassThings :: Class -> [TyThing]Source
isImplicitTyThing :: TyThing -> BoolSource
Returns True
if there should be no interface-file declaration
for this thing on its own: either it is built-in, or it is part
of some other declaration, or it is generated implicitly by some
other declaration.
lookupType :: DynFlags -> HomePackageTable -> PackageTypeEnv -> Name -> Maybe TyThingSource
Find the TyThing
for the given Name
by using all the resources
at our disposal: the compiled modules in the HomePackageTable
and the
compiled modules in other packages that live in PackageTypeEnv
. Note
that this does NOT look up the TyThing
in the module being compiled: you
have to do that yourself, if desired
lookupTypeHscEnv :: HscEnv -> Name -> IO (Maybe TyThing)Source
As lookupType
, but with a marginally easier-to-use interface
if you have a HscEnv
extendTypeEnv :: TypeEnv -> TyThing -> TypeEnvSource
extendTypeEnvList :: TypeEnv -> [TyThing] -> TypeEnvSource
extendTypeEnvWithIds :: TypeEnv -> [Id] -> TypeEnvSource
typeEnvElts :: TypeEnv -> [TyThing]Source
typeEnvClasses :: TypeEnv -> [Class]Source
typeEnvTyCons :: TypeEnv -> [TyCon]Source
typeEnvIds :: TypeEnv -> [Id]Source
typeEnvDataCons :: TypeEnv -> [DataCon]Source
typeEnvCoAxioms :: TypeEnv -> [CoAxiom]Source
MonadThings
class Monad m => MonadThings m whereSource
Class that abstracts out the common ability of the monads in GHC
to lookup a TyThing
in the monadic environment by Name
. Provides
a number of related convenience functions for accessing particular
kinds of TyThing
lookupThing :: Name -> m TyThingSource
lookupId :: Name -> m IdSource
lookupDataCon :: Name -> m DataConSource
lookupTyCon :: Name -> m TyConSource
lookupClass :: Name -> m ClassSource
MonadThings CoreM | |
MonadThings (IOEnv (Env TcGblEnv TcLclEnv)) | |
MonadThings (IOEnv (Env DsGblEnv DsLclEnv)) |
Information on imports and exports
type WhetherHasOrphans = BoolSource
Records whether a module has orphans. An "orphan" is one of:
- An instance declaration in a module other than the definition module for one of the type constructors or classes in the instance head
- A transformation rule in a module other than the one defining the function in the head of the rule
type IsBootInterface = BoolSource
Did this module originate from a *-boot file?
Records modules that we depend on by making a direct import from
UsagePackageModule | Module from another package |
| |
UsageHomeModule | Module from the current package |
|
data Dependencies Source
Dependency information about modules and packages below this one in the import hierarchy.
Invariant: the dependencies of a module M
never includes M
.
Invariant: none of the lists contain duplicates.
Deps | |
|
The NameCache makes sure that there is just one Unique assigned for each original name; i.e. (module-name, occ-name) pair and provides something of a lookup mechanism for those names.
NameCache | |
|
availsToNameSet :: [AvailInfo] -> NameSetSource
availName :: AvailInfo -> NameSource
Just the main name made available, i.e. not the available pieces
of type or class brought into scope by the GenAvailInfo
availNames :: AvailInfo -> [Name]Source
All names made available by the availability information
Records what things are available, i.e. in scope
Avail Name | An ordinary identifier in scope |
AvailTC Name [Name] | A type or class in scope. Parameters: 1) The name of the type or class 2) The available pieces of type or class. The AvailTC Invariant:
* If the type or class is itself
to be in scope, it must be *first* in this list.
Thus, typically: |
type IfaceExport = AvailInfoSource
The original names declared of a certain module that are exported
stableAvailCmp :: AvailInfo -> AvailInfo -> OrderingSource
Warnings
Warning information for a module
NoWarnings | Nothing deprecated |
WarnAll WarningTxt | Whole module deprecated |
WarnSome [(OccName, WarningTxt)] | Some specific things deprecated |
data WarningTxt Source
Linker stuff
Information we can use to dynamically link modules into the compiler
LM | |
|
linkableObjs :: Linkable -> [FilePath]Source
Objects which have yet to be linked by the compiler
nameOfObject :: Unlinked -> FilePathSource
Retrieve the filename of the linkable if possible. Panic if it is a byte-code object
isInterpretable :: Unlinked -> BoolSource
Is this a bytecode linkable with no file on disk?
byteCodeOfObject :: Unlinked -> CompiledByteCodeSource
Retrieve the compiled byte-code if possible. Panic if it is a file-based linkable
Program coverage
Information about a modules use of Haskell Program Coverage
HpcInfo | |
| |
NoHpcInfo | |
|
isHpcUsed :: HpcInfo -> AnyHpcUsageSource
Find out if HPC is used by this module or any of the modules it depends upon
type AnyHpcUsage = BoolSource
This is used to signal if one of my imports used HPC instrumentation even if there is no module-local HPC usage
Breakpoints
All the information about the breakpoints for a given module
ModBreaks | |
|
type BreakIndex = IntSource
Breakpoint index
Vectorisation information
Vectorisation information for ModGuts
, ModDetails
and ExternalPackageState
; see also
documentation at Vectorise.Env.GlobalEnv
.
VectInfo | |
|
data IfaceVectInfo Source
Vectorisation information for ModIface
; i.e, the vectorisation information propagated
across module boundaries.
IfaceVectInfo | |
|
plusVectInfo :: VectInfo -> VectInfo -> VectInfoSource
Safe Haskell information
data IfaceTrustInfo Source
Safe Haskell information for ModIface
Simply a wrapper around SafeHaskellMode to sepperate iface and flags
type IsSafeImport = BoolSource
Is an import a safe import?
Compilation errors and warnings
data SourceError Source
A source error is an error that is caused by one or more errors in the
source code. A SourceError
is thrown by many functions in the
compilation pipeline. Inside GHC these errors are merely printed via
log_action
, but API clients may treat them differently, for example,
insert them into a list box. If you want the default behaviour, use the
idiom:
handleSourceError printExceptionAndWarnings $ do ... api calls that may fail ...
The SourceError
s error messages can be accessed via srcErrorMessages
.
This list may be empty if the compiler failed due to -Werror
(Opt_WarnIsError
).
See printExceptionAndWarnings
for more information on what to take care
of when writing a custom error handler.
data GhcApiError Source
XXX: what exactly is an API error?
mkApiErr :: SDoc -> GhcApiErrorSource
throwOneError :: MonadIO m => ErrMsg -> m abSource
:: ExceptionMonad m | |
=> (SourceError -> m a) | exception handler |
-> m a | action to perform |
-> m a |
Perform the given action and call the exception handler if the action
throws a SourceError
. See SourceError
for more information.