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

Safe Haskell | Ignore
Language | GHC2021

GHC.Unit.Module.WholeCoreBindings

Synopsis

- data WholeCoreBindings = WholeCoreBindings {
  - wcb_bindings :: [IfaceBindingX IfaceMaybeRhs IfaceTopBndrInfo]
  - wcb_module :: Module
  - wcb_mod_location :: ModLocation
  - wcb_foreign :: IfaceForeign
  }
- newtype IfaceCLabel = IfaceCLabel CStubLabel
- data IfaceCStubs = IfaceCStubs {
  - header :: String
  - source :: String
  - initializers :: [IfaceCLabel]
  - finalizers :: [IfaceCLabel]
  }
- binary_put_ForeignSrcLang :: WriteBinHandle -> ForeignSrcLang -> IO ()
- binary_get_ForeignSrcLang :: ReadBinHandle -> IO ForeignSrcLang
- data IfaceForeignFile = IfaceForeignFile {
  - lang :: ForeignSrcLang
  - source :: String
  - extension :: FilePath
  }
- data IfaceForeign = IfaceForeign {
  - stubs :: Maybe IfaceCStubs
  - files :: [IfaceForeignFile]
  }
- emptyIfaceForeign :: IfaceForeign
- encodeIfaceForeign :: Logger -> DynFlags -> ForeignStubs -> [(ForeignSrcLang, FilePath)] -> IO IfaceForeign
- decodeIfaceForeign :: Logger -> TmpFs -> TempDir -> IfaceForeign -> IO (ForeignStubs, [(ForeignSrcLang, FilePath)])

# Documentation

data WholeCoreBindings #

Constructors

WholeCoreBindings |
Fields wcb_bindings :: [IfaceBindingX IfaceMaybeRhs IfaceTopBndrInfo] serialised tidied core bindings. wcb_module :: Module The module which the bindings are for wcb_mod_location :: ModLocation The location where the sources reside. | Stubs for foreign declarations and files added via `addForeignFilePath`. wcb_foreign :: IfaceForeign

newtype IfaceCLabel #

Wrapper for avoiding a dependency on `Binary` and `NFData` in `CLabel`.

Constructors

IfaceCLabel CStubLabel |

#### Instances

Instances details

NFData IfaceCLabel # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods rnf :: IfaceCLabel -> () #
Binary IfaceCLabel # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods put_ :: WriteBinHandle -> IfaceCLabel -> IO () # put :: WriteBinHandle -> IfaceCLabel -> IO (Bin IfaceCLabel) # get :: ReadBinHandle -> IO IfaceCLabel #
Outputable IfaceCLabel # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods ppr :: IfaceCLabel -> SDoc #

data IfaceCStubs #

Simplified encoding of `ForeignStubs` for interface serialization.

See Note [Foreign stubs and TH bytecode linking]

Constructors

IfaceCStubs |
Fields header :: String source :: String initializers :: [IfaceCLabel] finalizers :: [IfaceCLabel]

#### Instances

Instances details

NFData IfaceCStubs # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods rnf :: IfaceCStubs -> () #
Binary IfaceCStubs # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods put_ :: WriteBinHandle -> IfaceCStubs -> IO () # put :: WriteBinHandle -> IfaceCStubs -> IO (Bin IfaceCStubs) # get :: ReadBinHandle -> IO IfaceCStubs #
Outputable IfaceCStubs # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods ppr :: IfaceCStubs -> SDoc #

binary_put_ForeignSrcLang :: WriteBinHandle -> ForeignSrcLang -> IO () #

`Binary` `put_` for `ForeignSrcLang`.

binary_get_ForeignSrcLang :: ReadBinHandle -> IO ForeignSrcLang #

`Binary` `get` for `ForeignSrcLang`.

data IfaceForeignFile #

A source file added from Template Haskell using `qAddForeignFilePath`, for storage in interfaces.

See Note [Foreign stubs and TH bytecode linking]

Constructors

IfaceForeignFile |
Fields lang :: ForeignSrcLang The language is specified by the user. source :: String The contents of the file, which will be written to a temporary file when loaded from an interface. extension :: FilePath The extension used by the user is preserved, to avoid confusing external tools with an unexpected `.c` file or similar.

#### Instances

Instances details

NFData IfaceForeignFile # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods rnf :: IfaceForeignFile -> () #
Binary IfaceForeignFile # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods put_ :: WriteBinHandle -> IfaceForeignFile -> IO () # put :: WriteBinHandle -> IfaceForeignFile -> IO (Bin IfaceForeignFile) # get :: ReadBinHandle -> IO IfaceForeignFile #
Outputable IfaceForeignFile # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods ppr :: IfaceForeignFile -> SDoc #

data IfaceForeign #

Constructors

IfaceForeign |
Fields stubs :: Maybe IfaceCStubs files :: [IfaceForeignFile]

#### Instances

Instances details

NFData IfaceForeign # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods rnf :: IfaceForeign -> () #
Binary IfaceForeign # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods put_ :: WriteBinHandle -> IfaceForeign -> IO () # put :: WriteBinHandle -> IfaceForeign -> IO (Bin IfaceForeign) # get :: ReadBinHandle -> IO IfaceForeign #
Outputable IfaceForeign # |
Instance details Defined in GHC.Unit.Module.WholeCoreBindings Methods ppr :: IfaceForeign -> SDoc #

emptyIfaceForeign :: IfaceForeign #

encodeIfaceForeign :: Logger -> DynFlags -> ForeignStubs -> [(ForeignSrcLang, FilePath)] -> IO IfaceForeign #

Convert foreign stubs and foreign files to a format suitable for writing to interfaces.

See Note [Foreign stubs and TH bytecode linking]

decodeIfaceForeign :: Logger -> TmpFs -> TempDir -> IfaceForeign -> IO (ForeignStubs, [(ForeignSrcLang, FilePath)]) #

Decode serialized foreign stubs and foreign files.

See Note [Foreign stubs and TH bytecode linking]