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

Safe Haskell | Ignore
Language | GHC2021

GHC.Types.ForeignCall

Synopsis

- newtype ForeignCall = CCall CCallSpec
- isSafeForeignCall :: ForeignCall -> Bool
- data Safety
  - = PlaySafe
  - | PlayInterruptible
  - | PlayRisky
- playSafe :: Safety -> Bool
- playInterruptible :: Safety -> Bool
- data CExportSpec = CExportStatic SourceText CLabelString CCallConv
- type CLabelString = FastString
- isCLabelString :: CLabelString -> Bool
- pprCLabelString :: CLabelString -> SDoc
- data CCallSpec = CCallSpec CCallTarget CCallConv Safety
- data CCallTarget
  - = StaticTarget SourceText CLabelString (Maybe Unit) Bool
  - | DynamicTarget
- isDynamicTarget :: CCallTarget -> Bool
- data CCallConv
  - = CCallConv
  - | CApiConv
  - | StdCallConv
  - | PrimCallConv
  - | JavaScriptCallConv
- defaultCCallConv :: CCallConv
- ccallConvAttribute :: CCallConv -> SDoc
- data Header = Header SourceText FastString
- data CType = CType SourceText (Maybe Header) (SourceText, FastString)

# Documentation

newtype ForeignCall Source #

Constructors

CCall CCallSpec |

#### Instances

Instances details

Binary ForeignCall Source # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: WriteBinHandle -> ForeignCall -> IO () Source # put :: WriteBinHandle -> ForeignCall -> IO (Bin ForeignCall) Source # get :: ReadBinHandle -> IO ForeignCall Source #
Outputable ForeignCall Source # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: ForeignCall -> SDoc Source #
Eq ForeignCall Source # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: ForeignCall -> ForeignCall -> Bool Source # (/=) :: ForeignCall -> ForeignCall -> Bool Source #

isSafeForeignCall :: ForeignCall -> Bool Source #

data Safety Source #

Constructors

PlaySafe | Might invoke Haskell GC, or do a call back, or switch threads, etc. So make sure things are tidy before the call. Additionally, in the threaded RTS we arrange for the external call to be executed by a separate OS thread, i.e., _concurrently_ to the execution of other Haskell threads.
PlayInterruptible | Like PlaySafe, but additionally the worker thread running this foreign call may be unceremoniously killed, so it must be scheduled on an unbound thread.

PlayRisky

None of the above can happen; the call will return without interacting with the runtime system at all. Specifically:

- No GC
- No call backs
- No blocking
- No precise exceptions

#### Instances

Instances details

Data Safety Source # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Safety -> c Safety Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Safety Source #

toConstr :: Safety -> Constr Source #

dataTypeOf :: Safety -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Safety) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Safety) Source #

gmapT :: (forall b. Data b => b -> b) -> Safety -> Safety Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Safety -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Safety -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Safety -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Safety -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Safety -> m Safety Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Safety -> m Safety Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Safety -> m Safety Source #

Enum Safety Source # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

succ :: Safety -> Safety Source #

pred :: Safety -> Safety Source #

toEnum :: Int -> Safety Source #

fromEnum :: Safety -> Int Source #

enumFrom :: Safety -> [Safety] Source #

enumFromThen :: Safety -> Safety -> [Safety] Source #

enumFromTo :: Safety -> Safety -> [Safety] Source #

enumFromThenTo :: Safety -> Safety -> Safety -> [Safety] Source #

Show Safety Source # |
Instance details Defined in GHC.Types.ForeignCall Methods showsPrec :: Int -> Safety -> ShowS Source # show :: Safety -> String Source # showList :: [Safety] -> ShowS Source #
Binary Safety Source # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: WriteBinHandle -> Safety -> IO () Source # put :: WriteBinHandle -> Safety -> IO (Bin Safety) Source # get :: ReadBinHandle -> IO Safety Source #
Outputable Safety Source # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: Safety -> SDoc Source #
Eq Safety Source # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: Safety -> Safety -> Bool Source # (/=) :: Safety -> Safety -> Bool Source #
type Anno Safety Source # |
Instance details Defined in GHC.Hs.Decls type Anno Safety = EpaLocation

playSafe :: Safety -> Bool Source #

playInterruptible :: Safety -> Bool Source #

data CExportSpec Source #

Constructors

CExportStatic SourceText CLabelString CCallConv |

#### Instances

Instances details

Data CExportSpec Source # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CExportSpec -> c CExportSpec Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CExportSpec Source #

toConstr :: CExportSpec -> Constr Source #

dataTypeOf :: CExportSpec -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CExportSpec) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CExportSpec) Source #

gmapT :: (forall b. Data b => b -> b) -> CExportSpec -> CExportSpec Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CExportSpec -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CExportSpec -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CExportSpec -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CExportSpec -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CExportSpec -> m CExportSpec Source #

Binary CExportSpec Source # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: WriteBinHandle -> CExportSpec -> IO () Source # put :: WriteBinHandle -> CExportSpec -> IO (Bin CExportSpec) Source # get :: ReadBinHandle -> IO CExportSpec Source #
Outputable CExportSpec Source # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: CExportSpec -> SDoc Source #
type Anno CExportSpec Source # |
Instance details Defined in GHC.Hs.Decls type Anno CExportSpec = EpaLocation

type CLabelString = FastString Source #

isCLabelString :: CLabelString -> Bool Source #

pprCLabelString :: CLabelString -> SDoc Source #

data CCallSpec Source #

Constructors

CCallSpec CCallTarget CCallConv Safety |

#### Instances

Instances details

Binary CCallSpec Source # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: WriteBinHandle -> CCallSpec -> IO () Source # put :: WriteBinHandle -> CCallSpec -> IO (Bin CCallSpec) Source # get :: ReadBinHandle -> IO CCallSpec Source #
Outputable CCallSpec Source # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: CCallSpec -> SDoc Source #
Eq CCallSpec Source # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: CCallSpec -> CCallSpec -> Bool Source # (/=) :: CCallSpec -> CCallSpec -> Bool Source #

data CCallTarget Source #

How to call a particular function in C-land.

Constructors

StaticTarget SourceText CLabelString (Maybe Unit) Bool |
DynamicTarget |

#### Instances

Instances details

Data CCallTarget Source # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CCallTarget -> c CCallTarget Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CCallTarget Source #

toConstr :: CCallTarget -> Constr Source #

dataTypeOf :: CCallTarget -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CCallTarget) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CCallTarget) Source #

gmapT :: (forall b. Data b => b -> b) -> CCallTarget -> CCallTarget Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CCallTarget -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CCallTarget -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CCallTarget -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CCallTarget -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallTarget -> m CCallTarget Source #

Binary CCallTarget Source # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: WriteBinHandle -> CCallTarget -> IO () Source # put :: WriteBinHandle -> CCallTarget -> IO (Bin CCallTarget) Source # get :: ReadBinHandle -> IO CCallTarget Source #
Eq CCallTarget Source # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: CCallTarget -> CCallTarget -> Bool Source # (/=) :: CCallTarget -> CCallTarget -> Bool Source #

isDynamicTarget :: CCallTarget -> Bool Source #

data CCallConv Source #

Constructors

CCallConv |
CApiConv |
StdCallConv |
PrimCallConv |
JavaScriptCallConv |

#### Instances

Instances details

Data CCallConv Source # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CCallConv -> c CCallConv Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CCallConv Source #

toConstr :: CCallConv -> Constr Source #

dataTypeOf :: CCallConv -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CCallConv) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CCallConv) Source #

gmapT :: (forall b. Data b => b -> b) -> CCallConv -> CCallConv Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CCallConv -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CCallConv -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CCallConv -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CCallConv -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CCallConv -> m CCallConv Source #

Enum CCallConv Source # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

succ :: CCallConv -> CCallConv Source #

pred :: CCallConv -> CCallConv Source #

toEnum :: Int -> CCallConv Source #

fromEnum :: CCallConv -> Int Source #

enumFrom :: CCallConv -> [CCallConv] Source #

enumFromThen :: CCallConv -> CCallConv -> [CCallConv] Source #

enumFromTo :: CCallConv -> CCallConv -> [CCallConv] Source #

enumFromThenTo :: CCallConv -> CCallConv -> CCallConv -> [CCallConv] Source #

Binary CCallConv Source # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: WriteBinHandle -> CCallConv -> IO () Source # put :: WriteBinHandle -> CCallConv -> IO (Bin CCallConv) Source # get :: ReadBinHandle -> IO CCallConv Source #
Outputable CCallConv Source # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: CCallConv -> SDoc Source #
Eq CCallConv Source # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: CCallConv -> CCallConv -> Bool Source # (/=) :: CCallConv -> CCallConv -> Bool Source #
type Anno CCallConv Source # |
Instance details Defined in GHC.Hs.Decls type Anno CCallConv = EpaLocation

defaultCCallConv :: CCallConv Source #

ccallConvAttribute :: CCallConv -> SDoc Source #

data Header Source #

Constructors

Header SourceText FastString |

#### Instances

Instances details

Data Header Source # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Header -> c Header Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Header Source #

toConstr :: Header -> Constr Source #

dataTypeOf :: Header -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Header) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Header) Source #

gmapT :: (forall b. Data b => b -> b) -> Header -> Header Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Header -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Header -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Header -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Header -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Header -> m Header Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Header -> m Header Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Header -> m Header Source #

Binary Header Source # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: WriteBinHandle -> Header -> IO () Source # put :: WriteBinHandle -> Header -> IO (Bin Header) Source # get :: ReadBinHandle -> IO Header Source #
Outputable Header Source # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: Header -> SDoc Source #
Eq Header Source # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: Header -> Header -> Bool Source # (/=) :: Header -> Header -> Bool Source #

data CType Source #

A C type, used in CAPI FFI calls

Constructors

CType SourceText (Maybe Header) (SourceText, FastString) |

#### Instances

Instances details

Data CType Source # |

Instance details

Defined in GHC.Types.ForeignCall

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CType -> c CType Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CType Source #

toConstr :: CType -> Constr Source #

dataTypeOf :: CType -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CType) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CType) Source #

gmapT :: (forall b. Data b => b -> b) -> CType -> CType Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CType -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CType -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> CType -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CType -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CType -> m CType Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CType -> m CType Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CType -> m CType Source #

Binary CType Source # |
Instance details Defined in GHC.Types.ForeignCall Methods put_ :: WriteBinHandle -> CType -> IO () Source # put :: WriteBinHandle -> CType -> IO (Bin CType) Source # get :: ReadBinHandle -> IO CType Source #
Outputable CType Source # |
Instance details Defined in GHC.Types.ForeignCall Methods ppr :: CType -> SDoc Source #
Eq CType Source # |
Instance details Defined in GHC.Types.ForeignCall Methods (==) :: CType -> CType -> Bool Source # (/=) :: CType -> CType -> Bool Source #
type Anno CType Source # |
Instance details Defined in GHC.Hs.Decls type Anno CType = SrcSpanAnnP