ghc-9.10.0.20240426: The GHC API
Safe HaskellNone
LanguageGHC2021

GHC.Unit.Env

Synopsis

Documentation

data UnitEnv Source #

Constructors

UnitEnv 

Fields

unsafeGetHomeUnit :: UnitEnv -> HomeUnit Source #

Get home-unit

Unsafe because the home-unit may not be set

Unit Env helper functions

ue_renameUnitId :: HasDebugCallStack => UnitId -> UnitId -> UnitEnv -> UnitEnv Source #

Rename a unit id in the internal unit env.

ue_renameUnitId oldUnit newUnit UnitEnv, it is assumed that the oldUnit exists in the map, otherwise we panic. The DynFlags associated with the home unit will have its field homeUnitId set to newUnit.

HomeUnitEnv

data HomeUnitEnv Source #

Constructors

HomeUnitEnv 

Fields

  • homeUnitEnv_units :: !UnitState

    External units

  • homeUnitEnv_unit_dbs :: !(Maybe [UnitDatabase UnitId])

    Stack of unit databases for the target platform.

    This field is populated with the result of initUnits.

    Nothing means the databases have never been read from disk.

    Usually we don't reload the databases from disk if they are cached, even if the database flags changed!

  • homeUnitEnv_dflags :: DynFlags

    The dynamic flag settings

  • homeUnitEnv_hpt :: HomePackageTable

    The home package table describes already-compiled home-package modules, excluding the module we are compiling right now. (In one-shot mode the current module is the only home-package module, so homeUnitEnv_hpt is empty. All other modules count as "external-package" modules. However, even in GHCi mode, hi-boot interfaces are demand-loaded into the external-package table.)

    homeUnitEnv_hpt is not mutable because we only demand-load external packages; the home package is eagerly loaded, module by module, by the compilation manager.

    The HPT may contain modules compiled earlier by --make but not actually below the current module in the dependency graph.

    (This changes a previous invariant: changed Jan 05.)

  • homeUnitEnv_home_unit :: !(Maybe HomeUnit)

    Home-unit

Instances

Instances details
Outputable HomeUnitEnv Source # 
Instance details

Defined in GHC.Unit.Env

Methods

ppr :: HomeUnitEnv -> SDoc Source #

Outputable (UnitEnvGraph HomeUnitEnv) Source # 
Instance details

Defined in GHC.Unit.Env

UnitEnvGraph

newtype UnitEnvGraph v Source #

Constructors

UnitEnvGraph 

Instances

Instances details
Functor UnitEnvGraph Source # 
Instance details

Defined in GHC.Unit.Env

Methods

fmap :: (a -> b) -> UnitEnvGraph a -> UnitEnvGraph b #

(<$) :: a -> UnitEnvGraph b -> UnitEnvGraph a #

Foldable UnitEnvGraph Source # 
Instance details

Defined in GHC.Unit.Env

Methods

fold :: Monoid m => UnitEnvGraph m -> m #

foldMap :: Monoid m => (a -> m) -> UnitEnvGraph a -> m #

foldMap' :: Monoid m => (a -> m) -> UnitEnvGraph a -> m #

foldr :: (a -> b -> b) -> b -> UnitEnvGraph a -> b #

foldr' :: (a -> b -> b) -> b -> UnitEnvGraph a -> b #

foldl :: (b -> a -> b) -> b -> UnitEnvGraph a -> b #

foldl' :: (b -> a -> b) -> b -> UnitEnvGraph a -> b #

foldr1 :: (a -> a -> a) -> UnitEnvGraph a -> a #

foldl1 :: (a -> a -> a) -> UnitEnvGraph a -> a #

toList :: UnitEnvGraph a -> [a] #

null :: UnitEnvGraph a -> Bool #

length :: UnitEnvGraph a -> Int #

elem :: Eq a => a -> UnitEnvGraph a -> Bool #

maximum :: Ord a => UnitEnvGraph a -> a #

minimum :: Ord a => UnitEnvGraph a -> a #

sum :: Num a => UnitEnvGraph a -> a #

product :: Num a => UnitEnvGraph a -> a #

Traversable UnitEnvGraph Source # 
Instance details

Defined in GHC.Unit.Env

Methods

traverse :: Applicative f => (a -> f b) -> UnitEnvGraph a -> f (UnitEnvGraph b) #

sequenceA :: Applicative f => UnitEnvGraph (f a) -> f (UnitEnvGraph a) #

mapM :: Monad m => (a -> m b) -> UnitEnvGraph a -> m (UnitEnvGraph b) #

sequence :: Monad m => UnitEnvGraph (m a) -> m (UnitEnvGraph a) #

Outputable (UnitEnvGraph HomeUnitEnv) Source # 
Instance details

Defined in GHC.Unit.Env

unitEnv_foldWithKey :: (b -> UnitEnvGraphKey -> a -> b) -> b -> UnitEnvGraph a -> b Source #

Invariants

Preload units info

preloadUnitsInfo :: UnitEnv -> MaybeErr UnitErr [UnitInfo] Source #

Lookup UnitInfo for every preload unit from the UnitState and for every unit used to instantiate the home unit.

preloadUnitsInfo' :: UnitEnv -> [UnitId] -> MaybeErr UnitErr [UnitInfo] Source #

Lookup UnitInfo for every preload unit from the UnitState, for every unit used to instantiate the home unit, and for every unit explicitly passed in the given list of UnitId.

Home Module functions

isUnitEnvInstalledModule :: UnitEnv -> InstalledModule -> Bool Source #

Test if the module comes from the home unit