Moduleghc-9.10.3GHC2021
GHC.Unit.Module.ModIface
- 7 types
- 11 values
- Packageghc-9.10.3
- Exports20
- LanguageGHC2021
- LicenceBSD-3-Clause
- SourceModIface.hs
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.
See Note [Strictness in ModIface] to learn about why some fields are strict and others are not.
Constructors
ModIfacemi_module :: !ModuleName of the module we are for
mi_sig_of :: !Maybe ModuleAre we a sig of another mod?
mi_hsc_src :: !HscSourceBoot? Signature?
mi_deps :: DependenciesThe dependencies of the module. This is consulted for directly-imported modules, but not for anything else (hence lazy)
mi_usages :: [Usage]Usages; kept sorted so that it's easy to decide whether to write a new iface file (changing usages doesn't affect the hash of this module) NOT STRICT! we read this field lazily from the interface file It is *only* consulted by the recompilation checker
mi_exports :: ![IfaceExport]Exports Kept sorted by (mod,occ), to make version comparisons easier Records the modules that are the declaration points for things exported by this module, and the OccNames of those things
mi_used_th :: !BoolModule required TH splices when it was compiled. This disables recompilation avoidance (see #481).
mi_fixities :: [(OccName, Fixity)]Fixities NOT STRICT! we read this field lazily from the interface file
mi_warns :: IfaceWarningsWarnings NOT STRICT! we read this field lazily from the interface file
mi_anns :: [IfaceAnnotation]Annotations NOT STRICT! we read this field lazily from the interface file
mi_decls :: [IfaceDeclExts phase]Type, class and variable declarations The hash of an Id changes if its fixity or deprecations change (as well as its type of course) Ditto data constructors, class operations, except that the hash of the parent class/tycon changes
mi_extra_decls :: Maybe [IfaceBindingX IfaceMaybeRhs IfaceTopBndrInfo]Extra variable definitions which are **NOT** exposed but when combined with mi_decls allows us to restart code generation. See Note [Interface Files with Core Definitions] and Note [Interface File with Core: Sharing RHSs]
mi_globals :: !Maybe IfGlobalRdrEnvBinds all the things defined at the top level in the original source code for this module. which is NOT the same as mi_exports, nor mi_decls (which may contains declarations for things not actually defined by the user). Used for GHCi and for inspecting the contents of modules via the GHC API only.
(We need the source file to figure out the top-level environment, if we didn't compile this module from source then this field contains
Nothing).Strictly speaking this field should live in the
HomeModInfo, but that leads to more plumbing.mi_insts :: [IfaceClsInst]Sorted class instance
mi_fam_insts :: [IfaceFamInst]Sorted family instances
mi_rules :: [IfaceRule]Sorted rules
mi_hpc :: !AnyHpcUsageTrue if this program uses Hpc at any point in the program.
mi_trust :: !IfaceTrustInfoSafe Haskell Trust information for this module.
mi_trust_pkg :: !BoolDo we require the package this module resides in be trusted to trust this module? This is used for the situation where a module is Safe (so doesn't require the package be trusted itself) but imports some trustworthy modules from its own package (which does require its own package be trusted). See Note [Trust Own Package] in GHC.Rename.Names
mi_complete_matches :: ![IfaceCompleteMatch]mi_docs :: !Maybe DocsDocstrings and related data for use by haddock, the ghci
:doccommand, and other tools.Just _=the module was built with-haddock.mi_final_exts :: !IfaceBackendExts phaseEither
()or ModIfaceBackend for a fully instantiated interface.mi_ext_fields :: !ExtensibleFieldsAdditional optional fields, where the Map key represents the field name, resulting in a (size, serialized data) pair. Because the data is intended to be serialized through the internal Binary class (increasing compatibility with types using Name and
FastString, such as HIE), this format is chosen overByteStrings.mi_src_hash :: !FingerprintHash of the .hs source, used for recompilation checking.
Instances2Binary, NFData
Binary ModIfaceDefined in ghc-9.10.3 · GHC.Unit.Module.ModIface(NFData (IfaceBackendExts phase), NFData (IfaceDeclExts phase)) => NFData (ModIface_ phase)Defined in ghc-9.10.3 · GHC.Unit.Module.ModIface
Extends a PartialModIface with information which is either: * Computed after codegen * Or computed just before writing the iface to disk. (Hashes) In order to fully instantiate it.
Constructors
ModIfaceBackendmi_iface_hash :: !FingerprintHash of the whole interface
mi_mod_hash :: !FingerprintHash of the ABI only
mi_flag_hash :: !FingerprintHash of the important flags used when compiling the module, excluding optimisation flags
mi_opt_hash :: !FingerprintHash of optimisation flags
mi_hpc_hash :: !FingerprintHash of hpc flags
mi_plugin_hash :: !FingerprintHash of plugins
mi_orphan :: !WhetherHasOrphansWhether this module has orphans
mi_finsts :: !WhetherHasFamInstWhether this module has family instances. See Note [The type family instance consistency story].
mi_exp_hash :: !FingerprintHash of export list
mi_orphan_hash :: !FingerprintHash for orphan rules, class and family instances combined
mi_decl_warn_fn :: !OccName -> Maybe (WarningTxt GhcRn)Cached lookup for mi_warns for declaration deprecations
mi_export_warn_fn :: !Name -> Maybe (WarningTxt GhcRn)Cached lookup for mi_warns for export deprecations
mi_fix_fn :: !OccName -> Maybe FixityCached lookup for mi_fixities
mi_hash_fn :: !OccName -> Maybe (OccName, Fingerprint)Cached lookup for mi_decls. The
Nothingin mi_hash_fn means that the thing isn't in decls. It's useful to know that when seeing if we are up to date wrt. the old interface. The OccName is the parent of the name, if it has one.
Instances1NFData
NFData ModIfaceBackendDefined in ghc-9.10.3 · GHC.Unit.Module.ModIface
Selects a IfaceDecl representation. For fully instantiated interfaces we also maintain a fingerprint, which is used for recompilation checks.
Equations
IfaceDeclExts 'ModIfaceCore = IfaceDeclIfaceDeclExts 'ModIfaceFinal = (Fingerprint, IfaceDecl)
Equations
IfaceBackendExts 'ModIfaceCore = ()IfaceBackendExts 'ModIfaceFinal = ModIfaceBackend
The original names declared of a certain module that are exported
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 rewrite rule in a module other than the one defining the function in the head of the rule
Does this module define family instances?
Old-style accessor for whether or not the ModIface came from an hs-boot file.
Lookups up a (possibly cached) fixity from a ModIface. If one cannot be found, defaultFixity is returned instead.
The semantic module for this interface; e.g., if it's a interface
for a signature, if mi_module is p[A=A]:A, mi_semantic_module
will be A.
The "precise" free holes, e.g., the signatures that this ModIface depends on.
Given a set of free holes, and a unit identifier, rename
the free holes according to the instantiation of the unit
identifier. For example, if we have A and B free, and
our unit identity is p[A=C,B=impl:B], the renamed free
holes are just C.
Constructs cache for the mi_hash_fn field of a ModIface