GHC.Types.Target

ghc-9.10.0.20240426: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Types.Target

Synopsis

- data Target = Target {
  - targetId :: !TargetId
  - targetAllowObjCode :: !Bool
  - targetUnitId :: !UnitId
  - targetContents :: !(Maybe (InputFileBuffer, UTCTime))
  }
- data TargetId
  - = TargetModule !ModuleName
  - | TargetFile !FilePath !(Maybe Phase)
- type InputFileBuffer = StringBuffer
- pprTarget :: Target -> SDoc
- pprTargetId :: TargetId -> SDoc

# Documentation

data Target Source #

A compilation target.

A target may be supplied with the actual text of the module. If so, use this instead of the file contents (this is for use in an IDE where the file hasn't been saved by the user yet).

These fields are strict because Targets are long lived.

Constructors

Target |
Fields targetId :: !TargetId module or filename targetAllowObjCode :: !Bool object code allowed? targetUnitId :: !UnitId id of the unit this target is part of targetContents :: !(Maybe (InputFileBuffer, UTCTime)) Optional in-memory buffer containing the source code GHC should use for this target instead of reading it from disk. Since GHC version 8.10 modules which require preprocessors such as Literate Haskell or CPP to run are also supported. If a corresponding source file does not exist on disk this will result in a `SourceError` exception if `targetId = TargetModule _` is used. However together with `targetId = TargetFile _` GHC will not complain about the file missing.

#### Instances

Instances details

Outputable Target Source # |
Instance details Defined in GHC.Types.Target Methods ppr :: Target -> SDoc Source #

data TargetId Source #

Constructors

TargetModule !ModuleName | A module name: search for the file
TargetFile !FilePath !(Maybe Phase) | A filename: preprocess & parse it to find the module name. If specified, the Phase indicates how to compile this file (which phase to start from). Nothing indicates the starting phase should be determined from the suffix of the filename.

#### Instances

Instances details

Outputable TargetId Source # |
Instance details Defined in GHC.Types.Target Methods ppr :: TargetId -> SDoc Source #
Eq TargetId Source # |
Instance details Defined in GHC.Types.Target Methods (==) :: TargetId -> TargetId -> Bool # (/=) :: TargetId -> TargetId -> Bool #

type InputFileBuffer = StringBuffer Source #

pprTarget :: Target -> SDoc Source #

pprTargetId :: TargetId -> SDoc Source #