GHC.Unit.Module.WholeCoreBindings

ghc-9.14.0.20251028: The GHC API

Safe Haskell | None
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 Source #

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 Source #

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

Constructors

IfaceCLabel CStubLabel |

#### Instances

Instances details

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

data IfaceCStubs Source #

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

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

`Binary` `put_` for `ForeignSrcLang`.

binary_get_ForeignSrcLang :: ReadBinHandle -> IO ForeignSrcLang Source #

`Binary` `get` for `ForeignSrcLang`.

data IfaceForeignFile Source #

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

data IfaceForeign Source #

Constructors

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

#### Instances

Instances details

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

emptyIfaceForeign :: IfaceForeign Source #

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

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)]) Source #

Decode serialized foreign stubs and foreign files.

See Note [Foreign stubs and TH bytecode linking]