GHC.Unit.Types

ghc-lib-parser-9.14.1.20251220: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Unit.Types

Contents

- Modules
- Units
- Unit Ids
- Utils
- Wired-in units
- Boot modules

Description

Unit & Module types

This module is used to resolve the loops between Unit and Module types (Module references a Unit and vice-versa).

Synopsis

- data GenModule unit = Module {
  - moduleUnit :: !unit
  - moduleName :: !ModuleName
  }
- type Module = GenModule Unit
- type InstalledModule = GenModule UnitId
- type HomeUnitModule = GenModule UnitId
- type InstantiatedModule = GenModule InstantiatedUnit
- mkModule :: u -> ModuleName -> GenModule u
- moduleUnitId :: Module -> UnitId
- pprModule :: IsLine doc => Module -> doc
- pprInstantiatedModule :: InstantiatedModule -> SDoc
- moduleFreeHoles :: GenModule (GenUnit u) -> UniqDSet ModuleName
- class IsUnitId u
- data GenUnit uid
  - = RealUnit !(Definite uid)
  - | VirtUnit !(GenInstantiatedUnit uid)
  - | HoleUnit
- type Unit = GenUnit UnitId
- newtype UnitId = UnitId {
  - unitIdFS :: FastString
  }
- newtype UnitKey = UnitKey FastString
- data GenInstantiatedUnit unit = InstantiatedUnit {
  - instUnitFS :: !FastString
  - instUnitKey :: !Unique
  - instUnitInstanceOf :: !unit
  - instUnitInsts :: !(GenInstantiations unit)
  - instUnitHoles :: UniqDSet ModuleName
  }
- type InstantiatedUnit = GenInstantiatedUnit UnitId
- type DefUnitId = Definite UnitId
- type Instantiations = GenInstantiations UnitId
- type GenInstantiations unit = [(ModuleName, GenModule (GenUnit unit))]
- mkInstantiatedUnit :: IsUnitId u => u -> GenInstantiations u -> GenInstantiatedUnit u
- mkInstantiatedUnitHash :: IsUnitId u => u -> [(ModuleName, GenModule (GenUnit u))] -> FastString
- mkVirtUnit :: IsUnitId u => u -> [(ModuleName, GenModule (GenUnit u))] -> GenUnit u
- mapGenUnit :: IsUnitId v => (u -> v) -> GenUnit u -> GenUnit v
- mapInstantiations :: IsUnitId v => (u -> v) -> GenInstantiations u -> GenInstantiations v
- unitFreeModuleHoles :: GenUnit u -> UniqDSet ModuleName
- fsToUnit :: FastString -> Unit
- unitFS :: IsUnitId u => u -> FastString
- unitString :: IsUnitId u => u -> String
- toUnitId :: Unit -> UnitId
- virtualUnitId :: InstantiatedUnit -> UnitId
- stringToUnit :: String -> Unit
- stableUnitCmp :: Unit -> Unit -> Ordering
- unitIsDefinite :: Unit -> Bool
- isHoleUnit :: GenUnit u -> Bool
- pprUnit :: Unit -> SDoc
- unitIdString :: UnitId -> String
- stringToUnitId :: String -> UnitId
- newtype Definite unit = Definite {
  - unDefinite :: unit
  }
- ghcInternalUnitId :: UnitId
- rtsUnitId :: UnitId
- mainUnitId :: UnitId
- thisGhcUnitId :: UnitId
- interactiveUnitId :: UnitId
- interactiveGhciUnitId :: UnitId
- interactiveSessionUnitId :: UnitId
- ghcInternalUnit :: Unit
- rtsUnit :: Unit
- mainUnit :: Unit
- thisGhcUnit :: Unit
- interactiveUnit :: Unit
- interactiveGhciUnit :: Unit
- interactiveSessionUnit :: Unit
- isInteractiveModule :: Module -> Bool
- wiredInUnitIds :: [UnitId]
- data IsBootInterface
  - = NotBoot
  - | IsBoot
- data GenWithIsBoot mod = GWIB {
  - gwib_mod :: mod
  - gwib_isBoot :: IsBootInterface
  }
- type ModuleNameWithIsBoot = GenWithIsBoot ModuleName
- type ModuleWithIsBoot = GenWithIsBoot Module

# Modules

data GenModule unit #

A generic module is a pair of a unit identifier and a `ModuleName`.

Constructors

Module |
Fields moduleUnit :: !unit Unit the module belongs to moduleName :: !ModuleName Module name (e.g. A.B.C)

#### Instances

Instances details

Functor GenModule # |
Instance details Defined in GHC.Unit.Types Methods fmap :: (a -> b) -> GenModule a -> GenModule b # (<$) :: a -> GenModule b -> GenModule a #
Uniquable Module # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Module -> Unique #
Outputable InstalledModule # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstalledModule -> SDoc #
Outputable InstantiatedModule # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstantiatedModule -> SDoc #
Outputable Module # |
Instance details Defined in GHC.Unit.Types Methods ppr :: Module -> SDoc #
NFData (GenModule a) # |
Instance details Defined in GHC.Unit.Types Methods rnf :: GenModule a -> () #
Data unit => Data (GenModule unit) # |
Instance details Defined in GHC.Unit.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> GenModule unit -> c (GenModule unit) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (GenModule unit) # toConstr :: GenModule unit -> Constr # dataTypeOf :: GenModule unit -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (GenModule unit)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (GenModule unit)) # gmapT :: (forall b. Data b => b -> b) -> GenModule unit -> GenModule unit # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GenModule unit -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GenModule unit -> r # gmapQ :: (forall d. Data d => d -> u) -> GenModule unit -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> GenModule unit -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> GenModule unit -> m (GenModule unit) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GenModule unit -> m (GenModule unit) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GenModule unit -> m (GenModule unit) #
Binary a => Binary (GenModule a) # |
Instance details Defined in GHC.Unit.Types Methods put_ :: WriteBinHandle -> GenModule a -> IO () # put :: WriteBinHandle -> GenModule a -> IO (Bin (GenModule a)) # get :: ReadBinHandle -> IO (GenModule a) #
Eq unit => Eq (GenModule unit) # |
Instance details Defined in GHC.Unit.Types Methods (==) :: GenModule unit -> GenModule unit -> Bool # (/=) :: GenModule unit -> GenModule unit -> Bool #
Ord unit => Ord (GenModule unit) # |
Instance details Defined in GHC.Unit.Types Methods compare :: GenModule unit -> GenModule unit -> Ordering # (<) :: GenModule unit -> GenModule unit -> Bool # (<=) :: GenModule unit -> GenModule unit -> Bool # (>) :: GenModule unit -> GenModule unit -> Bool # (>=) :: GenModule unit -> GenModule unit -> Bool # max :: GenModule unit -> GenModule unit -> GenModule unit # min :: GenModule unit -> GenModule unit -> GenModule unit #

type Module = GenModule Unit #

A Module is a pair of a `Unit` and a `ModuleName`.

type InstalledModule = GenModule UnitId #

A `InstalledModule` is a `Module` whose unit is identified with an `UnitId`.

type HomeUnitModule = GenModule UnitId #

A `HomeUnitModule` is like an `InstalledModule` but we expect to find it in one of the home units rather than the package database.

type InstantiatedModule = GenModule InstantiatedUnit #

An `InstantiatedModule` is a `Module` whose unit is identified with an `InstantiatedUnit`.

mkModule :: u -> ModuleName -> GenModule u #

moduleUnitId :: Module -> UnitId #

pprModule :: IsLine doc => Module -> doc #

pprInstantiatedModule :: InstantiatedModule -> SDoc #

moduleFreeHoles :: GenModule (GenUnit u) -> UniqDSet ModuleName #

Calculate the free holes of a `Module`. If this set is non-empty, this module was defined in an indefinite library that had required signatures.

If a module has free holes, that means that substitutions can operate on it; if it has no free holes, substituting over a module has no effect.

# Units

class IsUnitId u #

Class for types that are used as unit identifiers (UnitKey, UnitId, Unit)

We need this class because we create new unit ids for virtual units (see VirtUnit) and they have to to be made from units with different kinds of identifiers.

Minimal complete definition

unitFS

#### Instances

Instances details

IsUnitId UnitId # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: UnitId -> FastString #
IsUnitId UnitKey # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: UnitKey -> FastString #
IsUnitId unit => IsUnitId (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: Definite unit -> FastString #
IsUnitId u => IsUnitId (GenUnit u) # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: GenUnit u -> FastString #

data GenUnit uid #

A unit identifier identifies a (possibly partially) instantiated library. It is primarily used as part of `Module`, which in turn is used in `Name`, which is used to give names to entities when typechecking.

There are two possible forms for a `Unit`:

1) It can be a `RealUnit`, in which case we just have a `DefUnitId` that uniquely identifies some fully compiled, installed library we have on disk.

2) It can be an `VirtUnit`. When we are typechecking a library with missing holes, we may need to instantiate a library on the fly (in which case we don't have any on-disk representation.) In that case, you have an `InstantiatedUnit`, which explicitly records the instantiation, so that we can substitute over it.

Constructors

RealUnit !(Definite uid) | Installed definite unit (either a fully instantiated unit or a closed unit)
VirtUnit !(GenInstantiatedUnit uid) | Virtual unit instantiated on-the-fly. It may be definite if all the holes are instantiated but we don't have code objects for it.
HoleUnit | Fake hole unit

#### Instances

Instances details

NFData Unit # |
Instance details Defined in GHC.Unit.Types Methods rnf :: Unit -> () #
Data Unit # |
Instance details Defined in GHC.Unit.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Unit -> c Unit # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Unit # toConstr :: Unit -> Constr # dataTypeOf :: Unit -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Unit) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Unit) # gmapT :: (forall b. Data b => b -> b) -> Unit -> Unit # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Unit -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Unit -> r # gmapQ :: (forall d. Data d => d -> u) -> Unit -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Unit -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Unit -> m Unit # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Unit -> m Unit # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Unit -> m Unit #
Show Unit # |
Instance details Defined in GHC.Unit.Types Methods showsPrec :: Int -> Unit -> ShowS # show :: Unit -> String # showList :: [Unit] -> ShowS #
Uniquable Module # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Module -> Unique #
Binary Unit # |
Instance details Defined in GHC.Unit.Types Methods put_ :: WriteBinHandle -> Unit -> IO () # put :: WriteBinHandle -> Unit -> IO (Bin Unit) # get :: ReadBinHandle -> IO Unit #
Outputable Module # |
Instance details Defined in GHC.Unit.Types Methods ppr :: Module -> SDoc #
Outputable Unit # |
Instance details Defined in GHC.Unit.Types Methods ppr :: Unit -> SDoc #
Ord Unit # |
Instance details Defined in GHC.Unit.Types Methods compare :: Unit -> Unit -> Ordering # (<) :: Unit -> Unit -> Bool # (<=) :: Unit -> Unit -> Bool # (>) :: Unit -> Unit -> Bool # (>=) :: Unit -> Unit -> Bool # max :: Unit -> Unit -> Unit # min :: Unit -> Unit -> Unit #
IsUnitId u => Uniquable (GenUnit u) # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: GenUnit u -> Unique #
IsUnitId u => IsUnitId (GenUnit u) # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: GenUnit u -> FastString #
IsUnitId u => Eq (GenUnit u) # |
Instance details Defined in GHC.Unit.Types Methods (==) :: GenUnit u -> GenUnit u -> Bool # (/=) :: GenUnit u -> GenUnit u -> Bool #

type Unit = GenUnit UnitId #

newtype UnitId #

A UnitId identifies a built library in a database and is used to generate unique symbols, etc. It's usually of the form:

pkgname-1.2:libname+hash

These UnitId are provided to us via the `-this-unit-id` flag.

The library in question may be definite or indefinite; if it is indefinite, none of the holes have been filled (we never install partially instantiated libraries as we can cheaply instantiate them on-the-fly, cf VirtUnit). Put another way, an installed unit id is either fully instantiated, or not instantiated at all.

Constructors

UnitId |
Fields unitIdFS :: FastString The full hashed unit identifier, including the component id and the hash.

#### Instances

Instances details

NFData Unit # |
Instance details Defined in GHC.Unit.Types Methods rnf :: Unit -> () #
NFData UnitId # |
Instance details Defined in GHC.Unit.Types Methods rnf :: UnitId -> () #
Data Unit # |
Instance details Defined in GHC.Unit.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Unit -> c Unit # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Unit # toConstr :: Unit -> Constr # dataTypeOf :: Unit -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Unit) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Unit) # gmapT :: (forall b. Data b => b -> b) -> Unit -> Unit # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Unit -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Unit -> r # gmapQ :: (forall d. Data d => d -> u) -> Unit -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Unit -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Unit -> m Unit # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Unit -> m Unit # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Unit -> m Unit #
Data UnitId # |
Instance details Defined in GHC.Unit.Types Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UnitId -> c UnitId # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UnitId # toConstr :: UnitId -> Constr # dataTypeOf :: UnitId -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UnitId) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UnitId) # gmapT :: (forall b. Data b => b -> b) -> UnitId -> UnitId # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UnitId -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UnitId -> r # gmapQ :: (forall d. Data d => d -> u) -> UnitId -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> UnitId -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> UnitId -> m UnitId # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UnitId -> m UnitId # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UnitId -> m UnitId #
Show Unit # |
Instance details Defined in GHC.Unit.Types Methods showsPrec :: Int -> Unit -> ShowS # show :: Unit -> String # showList :: [Unit] -> ShowS #
Uniquable Module # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Module -> Unique #
Uniquable UnitId # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: UnitId -> Unique #
IsUnitId UnitId # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: UnitId -> FastString #
Binary InstantiatedUnit # |
Instance details Defined in GHC.Unit.Types Methods put_ :: WriteBinHandle -> InstantiatedUnit -> IO () # put :: WriteBinHandle -> InstantiatedUnit -> IO (Bin InstantiatedUnit) # get :: ReadBinHandle -> IO InstantiatedUnit #
Binary Unit # |
Instance details Defined in GHC.Unit.Types Methods put_ :: WriteBinHandle -> Unit -> IO () # put :: WriteBinHandle -> Unit -> IO (Bin Unit) # get :: ReadBinHandle -> IO Unit #
Binary UnitId # |
Instance details Defined in GHC.Unit.Types Methods put_ :: WriteBinHandle -> UnitId -> IO () # put :: WriteBinHandle -> UnitId -> IO (Bin UnitId) # get :: ReadBinHandle -> IO UnitId #
Outputable InstalledModule # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstalledModule -> SDoc #
Outputable InstantiatedModule # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstantiatedModule -> SDoc #
Outputable InstantiatedUnit # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstantiatedUnit -> SDoc #
Outputable Module # |
Instance details Defined in GHC.Unit.Types Methods ppr :: Module -> SDoc #
Outputable Unit # |
Instance details Defined in GHC.Unit.Types Methods ppr :: Unit -> SDoc #
Outputable UnitId # |
Instance details Defined in GHC.Unit.Types Methods ppr :: UnitId -> SDoc #
Eq UnitId # |
Instance details Defined in GHC.Unit.Types Methods (==) :: UnitId -> UnitId -> Bool # (/=) :: UnitId -> UnitId -> Bool #
Ord Unit # |
Instance details Defined in GHC.Unit.Types Methods compare :: Unit -> Unit -> Ordering # (<) :: Unit -> Unit -> Bool # (<=) :: Unit -> Unit -> Bool # (>) :: Unit -> Unit -> Bool # (>=) :: Unit -> Unit -> Bool # max :: Unit -> Unit -> Unit # min :: Unit -> Unit -> Unit #
Ord UnitId # |
Instance details Defined in GHC.Unit.Types Methods compare :: UnitId -> UnitId -> Ordering # (<) :: UnitId -> UnitId -> Bool # (<=) :: UnitId -> UnitId -> Bool # (>) :: UnitId -> UnitId -> Bool # (>=) :: UnitId -> UnitId -> Bool # max :: UnitId -> UnitId -> UnitId # min :: UnitId -> UnitId -> UnitId #

newtype UnitKey #

A unit key in the database

Constructors

UnitKey FastString |

#### Instances

Instances details

IsUnitId UnitKey # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: UnitKey -> FastString #

data GenInstantiatedUnit unit #

An instantiated unit.

It identifies an indefinite library (with holes) that has been instantiated.

This unit may be indefinite or not (i.e. with remaining holes or not). If it is definite, we don't know if it has already been compiled and installed in a database. Nevertheless, we have a mechanism called "improvement" to try to match a fully instantiated unit with existing compiled and installed units: see Note [VirtUnit to RealUnit improvement].

An indefinite unit identifier pretty-prints to something like `p[H=H,A=aimpl:A>]` (`p` is the `UnitId`, and the brackets enclose the module substitution).

Constructors

InstantiatedUnit |
Fields instUnitFS :: !FastString A private, uniquely identifying representation of an InstantiatedUnit. This string is completely private to GHC and is just used to get a unique. instUnitKey :: !Unique Cached unique of `unitFS`. instUnitInstanceOf :: !unit The (indefinite) unit being instantiated. instUnitInsts :: !(GenInstantiations unit) The sorted (by `ModuleName`) instantiations of this unit. instUnitHoles :: UniqDSet ModuleName A cache of the free module holes of `instUnitInsts`. This lets us efficiently tell if a `InstantiatedUnit` has been fully instantiated (empty set of free module holes) and whether or not a substitution can have any effect.

#### Instances

Instances details

Binary InstantiatedUnit # |
Instance details Defined in GHC.Unit.Types Methods put_ :: WriteBinHandle -> InstantiatedUnit -> IO () # put :: WriteBinHandle -> InstantiatedUnit -> IO (Bin InstantiatedUnit) # get :: ReadBinHandle -> IO InstantiatedUnit #
Outputable InstantiatedModule # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstantiatedModule -> SDoc #
Outputable InstantiatedUnit # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstantiatedUnit -> SDoc #
Eq (GenInstantiatedUnit unit) # |
Instance details Defined in GHC.Unit.Types Methods (==) :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> Bool # (/=) :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> Bool #
Ord (GenInstantiatedUnit unit) # |
Instance details Defined in GHC.Unit.Types Methods compare :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> Ordering # (<) :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> Bool # (<=) :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> Bool # (>) :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> Bool # (>=) :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> Bool # max :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> GenInstantiatedUnit unit # min :: GenInstantiatedUnit unit -> GenInstantiatedUnit unit -> GenInstantiatedUnit unit #

type InstantiatedUnit = GenInstantiatedUnit UnitId #

type DefUnitId = Definite UnitId #

A `DefUnitId` is an `UnitId` with the invariant that it only refers to a definite library; i.e., one we have generated code for.

type Instantiations = GenInstantiations UnitId #

type GenInstantiations unit = [(ModuleName, GenModule (GenUnit unit))] #

mkInstantiatedUnit :: IsUnitId u => u -> GenInstantiations u -> GenInstantiatedUnit u #

Create a new `GenInstantiatedUnit` given an explicit module substitution.

mkInstantiatedUnitHash :: IsUnitId u => u -> [(ModuleName, GenModule (GenUnit u))] -> FastString #

Generate a uniquely identifying hash (internal unit-id) for an instantiated unit.

This is a one-way function. If the indefinite unit has not been instantiated at all, we return its unit-id.

This hash is completely internal to GHC and is not used for symbol names or file paths. It is different from the hash Cabal would produce for the same instantiated unit.

mkVirtUnit :: IsUnitId u => u -> [(ModuleName, GenModule (GenUnit u))] -> GenUnit u #

Smart constructor for instantiated GenUnit

mapGenUnit :: IsUnitId v => (u -> v) -> GenUnit u -> GenUnit v #

Map over the unit type of a `GenUnit`

mapInstantiations :: IsUnitId v => (u -> v) -> GenInstantiations u -> GenInstantiations v #

Map over the unit identifier of unit instantiations.

unitFreeModuleHoles :: GenUnit u -> UniqDSet ModuleName #

Retrieve the set of free module holes of a `Unit`.

fsToUnit :: FastString -> Unit #

Create a new simple unit identifier from a `FastString`. Internally, this is primarily used to specify wired-in unit identifiers.

unitFS :: IsUnitId u => u -> FastString #

unitString :: IsUnitId u => u -> String #

toUnitId :: Unit -> UnitId #

Return the UnitId of the Unit. For on-the-fly instantiated units, return the UnitId of the indefinite unit this unit is an instance of.

virtualUnitId :: InstantiatedUnit -> UnitId #

Return the virtual UnitId of an on-the-fly instantiated unit.

stringToUnit :: String -> Unit #

stableUnitCmp :: Unit -> Unit -> Ordering #

Compares unit ids lexically, rather than by their `Unique`s

unitIsDefinite :: Unit -> Bool #

A `Unit` is definite if it has no free holes.

isHoleUnit :: GenUnit u -> Bool #

pprUnit :: Unit -> SDoc #

# Unit Ids

unitIdString :: UnitId -> String #

stringToUnitId :: String -> UnitId #

# Utils

newtype Definite unit #

A definite unit (i.e. without any free module hole)

Constructors

Definite |
Fields unDefinite :: unit

#### Instances

Instances details

Functor Definite # |
Instance details Defined in GHC.Unit.Types Methods fmap :: (a -> b) -> Definite a -> Definite b # (<$) :: a -> Definite b -> Definite a #
Uniquable unit => Uniquable (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Definite unit -> Unique #
IsUnitId unit => IsUnitId (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: Definite unit -> FastString #
Binary unit => Binary (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods put_ :: WriteBinHandle -> Definite unit -> IO () # put :: WriteBinHandle -> Definite unit -> IO (Bin (Definite unit)) # get :: ReadBinHandle -> IO (Definite unit) #
Outputable unit => Outputable (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods ppr :: Definite unit -> SDoc #
Eq unit => Eq (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods (==) :: Definite unit -> Definite unit -> Bool # (/=) :: Definite unit -> Definite unit -> Bool #
Ord unit => Ord (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods compare :: Definite unit -> Definite unit -> Ordering # (<) :: Definite unit -> Definite unit -> Bool # (<=) :: Definite unit -> Definite unit -> Bool # (>) :: Definite unit -> Definite unit -> Bool # (>=) :: Definite unit -> Definite unit -> Bool # max :: Definite unit -> Definite unit -> Definite unit # min :: Definite unit -> Definite unit -> Definite unit #

# Wired-in units

ghcInternalUnitId :: UnitId #

rtsUnitId :: UnitId #

mainUnitId :: UnitId #

This is the package Id for the current program. It is the default package Id if you don't specify a package name. We don't add this prefix to symbol names, since there can be only one main package per program.

thisGhcUnitId :: UnitId #

interactiveUnitId :: UnitId #

interactiveGhciUnitId :: UnitId #

interactiveSessionUnitId :: UnitId #

ghcInternalUnit :: Unit #

rtsUnit :: Unit #

mainUnit :: Unit #

thisGhcUnit :: Unit #

interactiveUnit :: Unit #

interactiveGhciUnit :: Unit #

interactiveSessionUnit :: Unit #

isInteractiveModule :: Module -> Bool #

wiredInUnitIds :: [UnitId] #

# Boot modules

data IsBootInterface #

Indicates whether a module name is referring to a boot interface (hs-boot file) or regular module (hs file). We need to treat boot modules specially when building compilation graphs, since they break cycles. Regular source files and signature files are treated equivalently.

Constructors

NotBoot |
IsBoot |

#### Instances

Instances details

NFData IsBootInterface # |
Instance details Defined in Language.Haskell.Syntax.ImpExp.IsBoot Methods rnf :: IsBootInterface -> () #
Data IsBootInterface # |
Instance details Defined in Language.Haskell.Syntax.ImpExp.IsBoot Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IsBootInterface -> c IsBootInterface # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IsBootInterface # toConstr :: IsBootInterface -> Constr # dataTypeOf :: IsBootInterface -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IsBootInterface) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsBootInterface) # gmapT :: (forall b. Data b => b -> b) -> IsBootInterface -> IsBootInterface # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IsBootInterface -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IsBootInterface -> r # gmapQ :: (forall d. Data d => d -> u) -> IsBootInterface -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> IsBootInterface -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> IsBootInterface -> m IsBootInterface # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IsBootInterface -> m IsBootInterface # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IsBootInterface -> m IsBootInterface #
Show IsBootInterface # |
Instance details Defined in Language.Haskell.Syntax.ImpExp.IsBoot Methods showsPrec :: Int -> IsBootInterface -> ShowS # show :: IsBootInterface -> String # showList :: [IsBootInterface] -> ShowS #
Binary IsBootInterface # |
Instance details Defined in GHC.Utils.Binary Methods put_ :: WriteBinHandle -> IsBootInterface -> IO () # put :: WriteBinHandle -> IsBootInterface -> IO (Bin IsBootInterface) # get :: ReadBinHandle -> IO IsBootInterface #
Eq IsBootInterface # |
Instance details Defined in Language.Haskell.Syntax.ImpExp.IsBoot Methods (==) :: IsBootInterface -> IsBootInterface -> Bool # (/=) :: IsBootInterface -> IsBootInterface -> Bool #
Ord IsBootInterface # |
Instance details Defined in Language.Haskell.Syntax.ImpExp.IsBoot Methods compare :: IsBootInterface -> IsBootInterface -> Ordering # (<) :: IsBootInterface -> IsBootInterface -> Bool # (<=) :: IsBootInterface -> IsBootInterface -> Bool # (>) :: IsBootInterface -> IsBootInterface -> Bool # (>=) :: IsBootInterface -> IsBootInterface -> Bool # max :: IsBootInterface -> IsBootInterface -> IsBootInterface # min :: IsBootInterface -> IsBootInterface -> IsBootInterface #

data GenWithIsBoot mod #

This data type just pairs a value `mod` with an IsBootInterface flag. In practice, `mod` is usually a `Module` or `ModuleName`'.

Constructors

GWIB |
Fields gwib_mod :: mod gwib_isBoot :: IsBootInterface

#### Instances

Instances details

Functor GenWithIsBoot # |
Instance details Defined in GHC.Unit.Types Methods fmap :: (a -> b) -> GenWithIsBoot a -> GenWithIsBoot b # (<$) :: a -> GenWithIsBoot b -> GenWithIsBoot a #
Foldable GenWithIsBoot # |
Instance details Defined in GHC.Unit.Types Methods fold :: Monoid m => GenWithIsBoot m -> m # foldMap :: Monoid m => (a -> m) -> GenWithIsBoot a -> m # foldMap' :: Monoid m => (a -> m) -> GenWithIsBoot a -> m # foldr :: (a -> b -> b) -> b -> GenWithIsBoot a -> b # foldr' :: (a -> b -> b) -> b -> GenWithIsBoot a -> b # foldl :: (b -> a -> b) -> b -> GenWithIsBoot a -> b # foldl' :: (b -> a -> b) -> b -> GenWithIsBoot a -> b # foldr1 :: (a -> a -> a) -> GenWithIsBoot a -> a # foldl1 :: (a -> a -> a) -> GenWithIsBoot a -> a # toList :: GenWithIsBoot a -> [a] # null :: GenWithIsBoot a -> Bool # length :: GenWithIsBoot a -> Int # elem :: Eq a => a -> GenWithIsBoot a -> Bool # maximum :: Ord a => GenWithIsBoot a -> a # minimum :: Ord a => GenWithIsBoot a -> a # sum :: Num a => GenWithIsBoot a -> a # product :: Num a => GenWithIsBoot a -> a #
Traversable GenWithIsBoot # |
Instance details Defined in GHC.Unit.Types Methods traverse :: Applicative f => (a -> f b) -> GenWithIsBoot a -> f (GenWithIsBoot b) # sequenceA :: Applicative f => GenWithIsBoot (f a) -> f (GenWithIsBoot a) # mapM :: Monad m => (a -> m b) -> GenWithIsBoot a -> m (GenWithIsBoot b) # sequence :: Monad m => GenWithIsBoot (m a) -> m (GenWithIsBoot a) #
NFData mod => NFData (GenWithIsBoot mod) # |
Instance details Defined in GHC.Unit.Types Methods rnf :: GenWithIsBoot mod -> () #
Show mod => Show (GenWithIsBoot mod) # |
Instance details Defined in GHC.Unit.Types Methods showsPrec :: Int -> GenWithIsBoot mod -> ShowS # show :: GenWithIsBoot mod -> String # showList :: [GenWithIsBoot mod] -> ShowS #
Binary a => Binary (GenWithIsBoot a) # |
Instance details Defined in GHC.Unit.Types Methods put_ :: WriteBinHandle -> GenWithIsBoot a -> IO () # put :: WriteBinHandle -> GenWithIsBoot a -> IO (Bin (GenWithIsBoot a)) # get :: ReadBinHandle -> IO (GenWithIsBoot a) #
Outputable a => Outputable (GenWithIsBoot a) # |
Instance details Defined in GHC.Unit.Types Methods ppr :: GenWithIsBoot a -> SDoc #
Eq mod => Eq (GenWithIsBoot mod) # |
Instance details Defined in GHC.Unit.Types Methods (==) :: GenWithIsBoot mod -> GenWithIsBoot mod -> Bool # (/=) :: GenWithIsBoot mod -> GenWithIsBoot mod -> Bool #
Ord mod => Ord (GenWithIsBoot mod) # |
Instance details Defined in GHC.Unit.Types Methods compare :: GenWithIsBoot mod -> GenWithIsBoot mod -> Ordering # (<) :: GenWithIsBoot mod -> GenWithIsBoot mod -> Bool # (<=) :: GenWithIsBoot mod -> GenWithIsBoot mod -> Bool # (>) :: GenWithIsBoot mod -> GenWithIsBoot mod -> Bool # (>=) :: GenWithIsBoot mod -> GenWithIsBoot mod -> Bool # max :: GenWithIsBoot mod -> GenWithIsBoot mod -> GenWithIsBoot mod # min :: GenWithIsBoot mod -> GenWithIsBoot mod -> GenWithIsBoot mod #

type ModuleNameWithIsBoot = GenWithIsBoot ModuleName #

type ModuleWithIsBoot = GenWithIsBoot Module #