ghc-lib-parser-0.20220201: The GHC API, decoupled from GHC versions
Safe HaskellNone
LanguageHaskell2010

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 

Fields

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_insert :: UnitEnvGraphKey -> v -> UnitEnvGraph v -> UnitEnvGraph v Source #

unitEnv_delete :: UnitEnvGraphKey -> UnitEnvGraph v -> UnitEnvGraph v Source #

unitEnv_adjust :: (v -> v) -> UnitEnvGraphKey -> UnitEnvGraph v -> UnitEnvGraph v Source #

unitEnv_new :: Map UnitEnvGraphKey v -> UnitEnvGraph v Source #

unitEnv_singleton :: UnitEnvGraphKey -> v -> UnitEnvGraph v Source #

unitEnv_member :: UnitEnvGraphKey -> UnitEnvGraph v -> Bool Source #

unitEnv_lookup_maybe :: UnitEnvGraphKey -> UnitEnvGraph v -> Maybe v Source #

unitEnv_lookup :: UnitEnvGraphKey -> UnitEnvGraph v -> v Source #

unitEnv_keys :: UnitEnvGraph v -> Set UnitEnvGraphKey Source #

unitEnv_elts :: UnitEnvGraph v -> [(UnitEnvGraphKey, v)] Source #

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

unitEnv_mapWithKey :: (UnitEnvGraphKey -> v -> b) -> UnitEnvGraph v -> UnitEnvGraph 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