GHC.Driver.Session.Inspect

ghc-9.14.0.20251028: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Driver.Session.Inspect

Description

GHC API utilities for inspecting the GHC session

Synopsis

- getModuleGraph :: GhcMonad m => m ModuleGraph
- isLoaded :: GhcMonad m => ModuleName -> m Bool
- isLoadedModule :: GhcMonad m => UnitId -> ModuleName -> m Bool
- isLoadedHomeModule :: GhcMonad m => Module -> m Bool
- getBindings :: GhcMonad m => m [TyThing]
- getInsts :: GhcMonad m => m ([ClsInst], [FamInst])
- getNamePprCtx :: GhcMonad m => m NamePprCtx
- data ModuleInfo = ModuleInfo {
  - minf_type_env :: TypeEnv
  - minf_exports :: [AvailInfo]
  - minf_instances :: [ClsInst]
  - minf_iface :: Maybe ModIface
  - minf_safe :: SafeHaskellMode
  - minf_modBreaks :: Maybe InternalModBreaks
  }
- getModuleInfo :: GhcMonad m => Module -> m (Maybe ModuleInfo)
- getPackageModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo)
- availsToGlobalRdrEnv :: HasDebugCallStack => HscEnv -> Module -> [AvailInfo] -> IfGlobalRdrEnv
- getHomeModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo)
- modInfoTyThings :: ModuleInfo -> [TyThing]
- modInfoExports :: ModuleInfo -> [Name]
- modInfoExportsWithSelectors :: ModuleInfo -> [Name]
- modInfoInstances :: ModuleInfo -> [ClsInst]
- modInfoIsExportedName :: ModuleInfo -> Name -> Bool
- mkNamePprCtxForModule :: GhcMonad m => Module -> ModuleInfo -> m NamePprCtx
- modInfoLookupName :: GhcMonad m => ModuleInfo -> Name -> m (Maybe TyThing)
- modInfoIface :: ModuleInfo -> Maybe ModIface
- modInfoSafe :: ModuleInfo -> SafeHaskellMode
- modInfoModBreaks :: ModuleInfo -> Maybe InternalModBreaks

# Documentation

getModuleGraph :: GhcMonad m => m ModuleGraph Source #

Get the module dependency graph.

isLoaded :: GhcMonad m => ModuleName -> m Bool Source #

Deprecated: Prefer `isLoadedModule` and `isLoadedHomeModule`

Return `True` <==> module is loaded.

isLoadedModule :: GhcMonad m => UnitId -> ModuleName -> m Bool Source #

Check whether a `ModuleName` is found in the `HomePackageTable` for the given `UnitId`.

isLoadedHomeModule :: GhcMonad m => Module -> m Bool Source #

Check whether `Module` is part of the `HomeUnitGraph`.

Similar to `isLoadedModule`, but for `Module`s.

getBindings :: GhcMonad m => m [TyThing] Source #

Return the bindings for the current interactive session.

getInsts :: GhcMonad m => m ([ClsInst], [FamInst]) Source #

Return the instances for the current interactive session.

getNamePprCtx :: GhcMonad m => m NamePprCtx Source #

data ModuleInfo Source #

Container for information about a `Module`.

Constructors

ModuleInfo |
Fields minf_type_env :: TypeEnv minf_exports :: [AvailInfo] minf_instances :: [ClsInst] minf_iface :: Maybe ModIface minf_safe :: SafeHaskellMode minf_modBreaks :: Maybe InternalModBreaks

getModuleInfo :: GhcMonad m => Module -> m (Maybe ModuleInfo) Source #

Request information about a loaded `Module`

getPackageModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo) Source #

availsToGlobalRdrEnv :: HasDebugCallStack => HscEnv -> Module -> [AvailInfo] -> IfGlobalRdrEnv Source #

getHomeModuleInfo :: HscEnv -> Module -> IO (Maybe ModuleInfo) Source #

modInfoTyThings :: ModuleInfo -> [TyThing] Source #

The list of top-level entities defined in a module

modInfoExports :: ModuleInfo -> [Name] Source #

modInfoExportsWithSelectors :: ModuleInfo -> [Name] Source #

modInfoInstances :: ModuleInfo -> [ClsInst] Source #

Returns the instances defined by the specified module. Warning: currently unimplemented for package modules.

modInfoIsExportedName :: ModuleInfo -> Name -> Bool Source #

mkNamePprCtxForModule :: GhcMonad m => Module -> ModuleInfo -> m NamePprCtx Source #

modInfoLookupName :: GhcMonad m => ModuleInfo -> Name -> m (Maybe TyThing) Source #

modInfoIface :: ModuleInfo -> Maybe ModIface Source #

modInfoSafe :: ModuleInfo -> SafeHaskellMode Source #

Retrieve module safe haskell mode

modInfoModBreaks :: ModuleInfo -> Maybe InternalModBreaks Source #