GHC.Unit.Types

ghc-9.2.0.20210422: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

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 InstantiatedModule = GenModule InstantiatedUnit
- mkModule :: u -> ModuleName -> GenModule u
- pprModule :: Module -> SDoc
- 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 :: !(Indefinite unit)
  - instUnitInsts :: !(GenInstantiations unit)
  - instUnitHoles :: UniqDSet ModuleName
  }
- type InstantiatedUnit = GenInstantiatedUnit UnitId
- type IndefUnitId = Indefinite UnitId
- type DefUnitId = Definite UnitId
- type Instantiations = GenInstantiations UnitId
- type GenInstantiations unit = [(ModuleName, GenModule (GenUnit unit))]
- mkInstantiatedUnit :: IsUnitId u => Indefinite u -> GenInstantiations u -> GenInstantiatedUnit u
- mkInstantiatedUnitHash :: IsUnitId u => Indefinite u -> [(ModuleName, GenModule (GenUnit u))] -> FastString
- mkVirtUnit :: IsUnitId u => Indefinite 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
- unitIdString :: UnitId -> String
- stringToUnitId :: String -> UnitId
- newtype Definite unit = Definite {
  - unDefinite :: unit
  }
- newtype Indefinite unit = Indefinite {
  - indefUnit :: unit
  }
- primUnitId :: UnitId
- bignumUnitId :: UnitId
- baseUnitId :: UnitId
- rtsUnitId :: UnitId
- thUnitId :: UnitId
- mainUnitId :: UnitId
- thisGhcUnitId :: UnitId
- interactiveUnitId :: UnitId
- primUnit :: Unit
- bignumUnit :: Unit
- baseUnit :: Unit
- rtsUnit :: Unit
- thUnit :: Unit
- mainUnit :: Unit
- thisGhcUnit :: Unit
- interactiveUnit :: 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 Source #

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 Source # (<$) :: a -> GenModule b -> GenModule a Source #
Uniquable Module # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Module -> Unique Source #
Outputable InstalledModule # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstalledModule -> SDoc Source #
Outputable InstantiatedModule # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstantiatedModule -> SDoc Source #
Outputable Module # |
Instance details Defined in GHC.Unit.Types Methods ppr :: Module -> SDoc Source #
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) Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (GenModule unit) Source # toConstr :: GenModule unit -> Constr Source # dataTypeOf :: GenModule unit -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (GenModule unit)) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (GenModule unit)) Source # gmapT :: (forall b. Data b => b -> b) -> GenModule unit -> GenModule unit Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> GenModule unit -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> GenModule unit -> r Source # gmapQ :: (forall d. Data d => d -> u) -> GenModule unit -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> GenModule unit -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> GenModule unit -> m (GenModule unit) Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> GenModule unit -> m (GenModule unit) Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> GenModule unit -> m (GenModule unit) Source #
NFData (GenModule a) # |
Instance details Defined in GHC.Unit.Types Methods rnf :: GenModule a -> () Source #
Binary a => Binary (GenModule a) # |
Instance details Defined in GHC.Unit.Types Methods put_ :: BinHandle -> GenModule a -> IO () Source # put :: BinHandle -> GenModule a -> IO (Bin (GenModule a)) Source # get :: BinHandle -> IO (GenModule a) Source #
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 Source #

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

type InstalledModule = GenModule UnitId Source #

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

type InstantiatedModule = GenModule InstantiatedUnit Source #

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

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

pprModule :: Module -> SDoc Source #

pprInstantiatedModule :: InstantiatedModule -> SDoc Source #

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

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 Source #

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 Source #
IsUnitId UnitKey # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: UnitKey -> FastString Source #
IsUnitId unit => IsUnitId (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: Definite unit -> FastString Source #
IsUnitId u => IsUnitId (GenUnit u) # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: GenUnit u -> FastString Source #
IsUnitId unit => IsUnitId (Indefinite unit) # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: Indefinite unit -> FastString Source #

data GenUnit uid Source #

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

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

newtype UnitId Source #

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

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

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 Source #

data GenInstantiatedUnit unit Source #

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 `IndefUnitId`, 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 :: !(Indefinite 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_ :: BinHandle -> InstantiatedUnit -> IO () Source # put :: BinHandle -> InstantiatedUnit -> IO (Bin InstantiatedUnit) Source # get :: BinHandle -> IO InstantiatedUnit Source #
Outputable InstantiatedModule # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstantiatedModule -> SDoc Source #
Outputable InstantiatedUnit # |
Instance details Defined in GHC.Unit.Types Methods ppr :: InstantiatedUnit -> SDoc Source #
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 Source #

type IndefUnitId = Indefinite UnitId Source #

An `IndefUnitId` is an `UnitId` with the invariant that it only refers to an indefinite library; i.e., one that can be instantiated.

type DefUnitId = Definite UnitId Source #

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 Source #

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

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

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

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

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 => Indefinite u -> [(ModuleName, GenModule (GenUnit u))] -> GenUnit u Source #

Smart constructor for instantiated GenUnit

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

Map over the unit type of a `GenUnit`

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

Map over the unit identifier of unit instantiations.

unitFreeModuleHoles :: GenUnit u -> UniqDSet ModuleName Source #

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

fsToUnit :: FastString -> Unit Source #

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 Source #

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

toUnitId :: Unit -> UnitId Source #

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 Source #

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

stringToUnit :: String -> Unit Source #

stableUnitCmp :: Unit -> Unit -> Ordering Source #

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

unitIsDefinite :: Unit -> Bool Source #

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

isHoleUnit :: GenUnit u -> Bool Source #

# Unit Ids

unitIdString :: UnitId -> String Source #

stringToUnitId :: String -> UnitId Source #

# Utils

newtype Definite unit Source #

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 Source # (<$) :: a -> Definite b -> Definite a Source #
Uniquable unit => Uniquable (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods getUnique :: Definite unit -> Unique Source #
IsUnitId unit => IsUnitId (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods unitFS :: Definite unit -> FastString Source #
Binary unit => Binary (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods put_ :: BinHandle -> Definite unit -> IO () Source # put :: BinHandle -> Definite unit -> IO (Bin (Definite unit)) Source # get :: BinHandle -> IO (Definite unit) Source #
Outputable unit => Outputable (Definite unit) # |
Instance details Defined in GHC.Unit.Types Methods ppr :: Definite unit -> SDoc Source #
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 #

newtype Indefinite unit Source #

Constructors

Indefinite |
Fields indefUnit :: unit

#### Instances

Instances details

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

# Wired-in units

primUnitId :: UnitId Source #

bignumUnitId :: UnitId Source #

baseUnitId :: UnitId Source #

rtsUnitId :: UnitId Source #

thUnitId :: UnitId Source #

mainUnitId :: UnitId Source #

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 Source #

interactiveUnitId :: UnitId Source #

primUnit :: Unit Source #

bignumUnit :: Unit Source #

baseUnit :: Unit Source #

rtsUnit :: Unit Source #

thUnit :: Unit Source #

mainUnit :: Unit Source #

thisGhcUnit :: Unit Source #

interactiveUnit :: Unit Source #

isInteractiveModule :: Module -> Bool Source #

wiredInUnitIds :: [UnitId] Source #

# Boot modules

data IsBootInterface Source #

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

Data IsBootInterface # |
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) -> IsBootInterface -> c IsBootInterface Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IsBootInterface Source # toConstr :: IsBootInterface -> Constr Source # dataTypeOf :: IsBootInterface -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c IsBootInterface) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IsBootInterface) Source # gmapT :: (forall b. Data b => b -> b) -> IsBootInterface -> IsBootInterface Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IsBootInterface -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IsBootInterface -> r Source # gmapQ :: (forall d. Data d => d -> u) -> IsBootInterface -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> IsBootInterface -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> IsBootInterface -> m IsBootInterface Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IsBootInterface -> m IsBootInterface Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IsBootInterface -> m IsBootInterface Source #
Show IsBootInterface # |
Instance details Defined in GHC.Unit.Types Methods showsPrec :: Int -> IsBootInterface -> ShowS Source # show :: IsBootInterface -> String Source # showList :: [IsBootInterface] -> ShowS Source #
Binary IsBootInterface # |
Instance details Defined in GHC.Unit.Types Methods put_ :: BinHandle -> IsBootInterface -> IO () Source # put :: BinHandle -> IsBootInterface -> IO (Bin IsBootInterface) Source # get :: BinHandle -> IO IsBootInterface Source #
Eq IsBootInterface # |
Instance details Defined in GHC.Unit.Types Methods (==) :: IsBootInterface -> IsBootInterface -> Bool # (/=) :: IsBootInterface -> IsBootInterface -> Bool #
Ord IsBootInterface # |
Instance details Defined in GHC.Unit.Types 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 Source #

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

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

type ModuleWithIsBoot = GenWithIsBoot Module Source #