GHC.Unit.Module

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

Safe Haskell | Ignore
Language | GHC2021

GHC.Unit.Module

Contents

- The ModuleName type
- The ModLocation type
- ModuleEnv
- Generalization
- The Module type

Synopsis

- module GHC.Unit.Types
- module Language.Haskell.Syntax.Module.Name
- module GHC.Unit.Module.Location
- module GHC.Unit.Module.Env
- getModuleInstantiation :: Module -> (InstalledModule, Maybe InstantiatedModule)
- getUnitInstantiations :: Unit -> (UnitId, Maybe InstantiatedUnit)
- uninstantiateInstantiatedUnit :: InstantiatedUnit -> InstantiatedUnit
- uninstantiateInstantiatedModule :: InstantiatedModule -> InstantiatedModule
- mkHoleModule :: ModuleName -> GenModule (GenUnit u)
- isHoleModule :: GenModule (GenUnit u) -> Bool
- stableModuleCmp :: Module -> Module -> Ordering
- moduleStableString :: Module -> String
- moduleIsDefinite :: Module -> Bool
- class HasModule (m :: Type -> Type) where
  - getModule :: m Module
- class ContainsModule t where
  - extractModule :: t -> Module
- installedModuleEq :: InstalledModule -> Module -> Bool

# Documentation

module GHC.Unit.Types

# The ModuleName type

module Language.Haskell.Syntax.Module.Name

# The ModLocation type

module GHC.Unit.Module.Location

# ModuleEnv

module GHC.Unit.Module.Env

# Generalization

getModuleInstantiation :: Module -> (InstalledModule, Maybe InstantiatedModule) #

Given a possibly on-the-fly instantiated module, split it into a `Module` that we definitely can find on-disk, as well as an instantiation if we need to instantiate it on the fly. If the instantiation is `Nothing` no on-the-fly renaming is needed.

getUnitInstantiations :: Unit -> (UnitId, Maybe InstantiatedUnit) #

Return the unit-id this unit is an instance of and the module instantiations (if any).

uninstantiateInstantiatedUnit :: InstantiatedUnit -> InstantiatedUnit #

Remove instantiations of the given instantiated unit

uninstantiateInstantiatedModule :: InstantiatedModule -> InstantiatedModule #

Remove instantiations of the given module instantiated unit

# The Module type

mkHoleModule :: ModuleName -> GenModule (GenUnit u) #

Create a hole Module

isHoleModule :: GenModule (GenUnit u) -> Bool #

Test if a Module is not instantiated

stableModuleCmp :: Module -> Module -> Ordering #

This gives a stable ordering, as opposed to the Ord instance which gives an ordering based on the `Unique`s of the components, which may not be stable from run to run of the compiler.

moduleStableString :: Module -> String #

Get a string representation of a `Module` that's unique and stable across recompilations. eg. "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal"

moduleIsDefinite :: Module -> Bool #

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

class HasModule (m :: Type -> Type) where #

Methods

getModule :: m Module #

#### Instances

Instances details

HasModule CoreM # |
Instance details Defined in GHC.Core.Opt.Monad Methods getModule :: CoreM Module #
ContainsModule env => HasModule (IOEnv env) # |
Instance details Defined in GHC.Data.IOEnv Methods getModule :: IOEnv env Module #

class ContainsModule t where #

Methods

extractModule :: t -> Module #

#### Instances

Instances details

ContainsModule TcGblEnv # |
Instance details Defined in GHC.Tc.Types Methods extractModule :: TcGblEnv -> Module #
ContainsModule gbl => ContainsModule (Env gbl lcl) # |
Instance details Defined in GHC.Tc.Types Methods extractModule :: Env gbl lcl -> Module #

installedModuleEq :: InstalledModule -> Module -> Bool #

Test if a `Module` corresponds to a given `InstalledModule`, modulo instantiation.