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.Home

The home unit is the unit (i.e. compiled package) that contains the module we are compiling/typechecking.

  • 2 types
  • 23 values
  • Packageghc-9.10.3
  • Exports25
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceHome.hs
datadata GenHomeUnit u
#

Information about the home unit (i.e., the until that will contain the modules we are compiling)

The unit identifier of the instantiating units is left open to allow switching from UnitKey (what is provided by the user) to UnitId (internal unit identifier) with homeUnitMap.

TODO: this isn't implemented yet. UnitKeys are still converted too early into UnitIds in GHC.Unit.State.readUnitDataBase

Constructors

Return the unit id of the unit that is instantiated by the home unit.

E.g. if home unit = q[A=p:B,...] we return q.

If the home unit is not an instance of another unit, we return its own unit id (it is an instance of itself if you will).

Return the unit id of the unit that is instantiated by the home unit.

E.g. if home unit = q[A=p:B,...] we return (Just q).

If the home unit is not an instance of another unit, we return Nothing.

valuehomeUnitAsUnit :: HomeUnit -> Unit
#

Return the home unit as a normal unit.

We infer from the home unit itself the kind of unit we create: 1. If the home unit is definite, we must be compiling so we return a real unit. The definite home unit may be the result of a unit instantiation, say `p = q[A=r:X]`. In this case we could have returned a virtual unit `q[A=r:X]` but it's not what the clients of this function expect, especially because p is lost when we do this. The unit id of a virtual unit is made up internally so `unitId(q[A=r:X])` is not equal to p.

  1. If the home unit is indefinite we can only create a virtual unit from it. It's ok because we must be only typechecking the home unit so we won't produce any code object that rely on the unit id of this virtual unit.

Predicates

13 declarations

Helpers

4 declarations

Return the module that is used to instantiate the given home module.

If the given module isn't a module hole, return the actual home module.

E.g., the instantiating module of p:A in p[A=q[]:B] is q[]:B. the instantiating module of r:A in p[A=q[]:B] is r:A. the instantiating module of p:A in p is p:A. the instantiating module of r:A in p is r:A.

Return the module that is used to instantiate the given home module name. If the ModuleName doesn't refer to a signature, return the actual home module.

E.g., the instantiating module of A in p[A=q[]:B] is q[]:B. the instantiating module of A in p is p:A.