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

Safe Haskell | Ignore
Language | GHC2021

GHC.Driver.Backpack.Syntax

Contents

- Backpack abstract syntax

Description

This is the syntax for bkp files which are parsed in 'ghc --backpack' mode. This syntax is used purely for testing purposes.

Synopsis

- data HsUnitId n = HsUnitId (Located n) [LHsModuleSubst n]
- type LHsUnitId n = Located (HsUnitId n)
- type HsModuleSubst n = (Located ModuleName, LHsModuleId n)
- type LHsModuleSubst n = Located (HsModuleSubst n)
- data HsModuleId n
  - = HsModuleVar (Located ModuleName)
  - | HsModuleId (LHsUnitId n) (Located ModuleName)
- type LHsModuleId n = Located (HsModuleId n)
- data HsComponentId = HsComponentId {
  - hsPackageName :: PackageName
  - hsComponentId :: UnitId
  }
- type LHsUnit n = Located (HsUnit n)
- data HsUnit n = HsUnit {
  - hsunitName :: Located n
  - hsunitBody :: [LHsUnitDecl n]
  }
- type LHsUnitDecl n = Located (HsUnitDecl n)
- data HsUnitDecl n
  - = DeclD HscSource (Located ModuleName) (Located (HsModule GhcPs))
  - | IncludeD (IncludeDecl n)
- data IncludeDecl n = IncludeDecl {
  - idUnitId :: LHsUnitId n
  - idModRenaming :: Maybe [LRenaming]
  - idSignatureInclude :: Bool
  }
- type LRenaming = Located Renaming
- data Renaming = Renaming {
  - renameFrom :: Located ModuleName
  - renameTo :: Maybe (Located ModuleName)
  }

# Backpack abstract syntax

data HsUnitId n #

Constructors

HsUnitId (Located n) [LHsModuleSubst n] |

type LHsUnitId n = Located (HsUnitId n) #

type HsModuleSubst n = (Located ModuleName, LHsModuleId n) #

type LHsModuleSubst n = Located (HsModuleSubst n) #

data HsModuleId n #

Constructors

HsModuleVar (Located ModuleName) |
HsModuleId (LHsUnitId n) (Located ModuleName) |

type LHsModuleId n = Located (HsModuleId n) #

data HsComponentId #

Constructors

HsComponentId |

Fields

- hsPackageName :: PackageName
- hsComponentId :: UnitId

#### Instances

Instances details

Outputable HsComponentId # |
Instance details Defined in GHC.Driver.Backpack.Syntax Methods ppr :: HsComponentId -> SDoc #

type LHsUnit n = Located (HsUnit n) #

data HsUnit n #

Top level `unit` declaration in a Backpack file.

Constructors

HsUnit |

Fields

- hsunitName :: Located n
- hsunitBody :: [LHsUnitDecl n]

type LHsUnitDecl n = Located (HsUnitDecl n) #

data HsUnitDecl n #

A declaration in a package, e.g. a module or signature definition, or an include.

Constructors

DeclD HscSource (Located ModuleName) (Located (HsModule GhcPs)) |
IncludeD (IncludeDecl n) |

data IncludeDecl n #

An include of another unit

Constructors

IncludeDecl |

Fields

- idUnitId :: LHsUnitId n
- idModRenaming :: Maybe [LRenaming]
- idSignatureInclude :: Bool

  Is this a `dependency signature` include? If so, we don't compile this include when we instantiate this unit (as there should not be any modules brought into scope.)

type LRenaming = Located Renaming #

data Renaming #

Rename a module from one name to another. The identity renaming means that the module should be brought into scope.

Constructors

Renaming |

Fields

- renameFrom :: Located ModuleName
- renameTo :: Maybe (Located ModuleName)