HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleghc-9.10.3GHC2021

GHC.Unit.Module.ModIface

  • 7 types
  • 11 values
  • Packageghc-9.10.3
  • Exports20
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceModIface.hs
datadata ModIface_ (phase :: ModIfacePhase)
#

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

  • ModIface
    • mi_module :: !Module

      Name of the module we are for

    • mi_sig_of :: !Maybe Module

      Are we a sig of another mod?

    • mi_hsc_src :: !HscSource

      Boot? Signature?

    • mi_deps :: Dependencies

      The 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 :: !Bool

      Module 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 :: IfaceWarnings

      Warnings 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 IfGlobalRdrEnv

      Binds 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 :: !AnyHpcUsage

      True if this program uses Hpc at any point in the program.

    • mi_trust :: !IfaceTrustInfo

      Safe Haskell Trust information for this module.

    • mi_trust_pkg :: !Bool

      Do 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 Docs

      Docstrings and related data for use by haddock, the ghci :doc command, and other tools.

      Just _ = the module was built with -haddock.

    • mi_final_exts :: !IfaceBackendExts phase

      Either () or ModIfaceBackend for a fully instantiated interface.

    • mi_ext_fields :: !ExtensibleFields

      Additional 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 over ByteStrings.

    • mi_src_hash :: !Fingerprint

      Hash of the .hs source, used for recompilation checking.

Instances2Binary, NFData
datadata ModIfaceBackend
#

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

Instances1NFData
typetype WhetherHasOrphans = Bool
#

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